Getting Maven to install a .jar in a sub-folder of plugins

maven
imagej

#1

Dear Maven Gurus,

We have a few different plugins that we offer from our update site. These are under a folder ‘BIOP’ inside the plugins folder of Fiji, for convenience.

When I mavenized these, I defined a property in the POM to point to my Fiji installation by setting

imagej.app.directory

to whatever my Fiji install folder is.

This however only copies the compiled .jar to the plugins folder. Is there a way to define a subfolder?

Alternatively, I could modify the plugins.config file so that all plugins are in the plugins folder but appear under the ‘BIOP’ submenu in Fiji, but I liked seggregating the plugins, made searching for files easier withing the plugins folder.

Many thanks


#2

Dear @oburri,

afaict, the imagej-maven-plugin either copies the generate JAR to plugins/ or jars/ depending on a heuristic that argues about whether it is an ImageJ1 or an ImageJ2 plugin. So there is currently no support for subdirectories of either of the aforementioned.

As discussed in imagej-maven-plugin#13 there is the <name>plugins/myPlugin.jar</name> property that might be exploited to implement copying to subfolders. Feel free to open an issue on the topic and reference imagej-maven-plugin#13 in there.

Best,
Stefan


#3

Correct. And worse: there is even a special-cased hack for Bio-Formats. Much better would be to have a Maven property which is respected.

Relatedly, I also think delete.other.versions should be true by default—and that that property should instead be called scijava.deleteOtherVersions. And that all this functionality should be moved upstream and generalized to the scijava-maven-plugin.

Anyway, as always: patches of any size are very welcome.


#4

Well it’s almost been a year. so why not rekindle this.

I have looked at

And have suggested a modification that could handle the possibility of storing plugins into subfolders using a jars.subdirectory property in the POM, while keeping the rest of the structure untouched. If this property is not set, then nothing should change on the current behaviour, save a new log message.

I have created a Pull request, but it would require testing at least once…
https://github.com/imagej/imagej-maven-plugin/pull/17

If anyone has any suggestions on how I could test this bit of code, as I have no idea how to integrate it with my current Maven setup on Eclipse…


#5

Well, the Travis Build fails without too explicit of an error, and without further help from the forum,I guess it will stagnate for a bit longer :slight_smile:


#6

Thanks for looking into this @oburri :thumbsup:

I haven’t had time to try it yet, but looking at the source code I fear that all JARs (including dependencies) will be copied into the subdirectory?


#7

Hah, yeah I hadn’t thought of the fact that dependencies would be copied along in the same folder… Somehow I thought it was done separately.

Would one way be to fix this be to use the main-class property in the POM, to only copy it in the subfolder when it is part of the main jar file?

However I guess that this means we’d have to check the dependencies within the whole imageJDirectory to make sure that they are installed elsewhere…

AAah, I hadn’t thought about the dependencies…


#8

Currently, the artifact that you are building is handled just like the other dependencies (see AbstractCopyJarsMojo.java#L127-L185) w.r.t. to copying everything.

So those lines

have to be changed to use imageJSubDirectory but only for the artifact we are building. That, however, is some Maven magic that I don’t actually have a clue about :wink:


#9

Did you get an answer for this part? You can change which version of the imagej-maven-plugin is used by overriding it in your POM:

<plugins>
	<plugin>
		<groupId>net.imagej</groupId>
		<artifactId>imagej-maven-plugin</artifactId>
		<version>0.6.1-SNAPSHOT</version><!-- or whatever version you built locally -->
	</plugin>
</plugins>

Well, it should be simple to test whether project.getArtifact() matches dependencyNode.getArtifact() in the execute() method of CopyJarsMojo, and then feed that value to the installArtifact method so that it can discriminate appropriately, no?


#10

Yes, although we had (to fix) some Maven 2/3 issues on the way. When you find the time, @ctrueden, could take a look at https://github.com/imagej/imagej-maven-plugin/pull/19? Once that’s merged we can go ahead with the subdirectory part…

@oburri: could you please take a look at my latest comment in the PR: https://github.com/imagej/imagej-maven-plugin/pull/17#issuecomment-323678678


#11

@stelfrich thanks! that looks awesome!

However I was wondering about the dependencies…

Suppose that I make a library SuperLib.jar and keep it in a custom folder. I then upload this to my update site.

Later, another project that makes use of SuperLib.jar is being built by maven with yet another custom folder, and it so happens that SuperLib.jar is already there and cozy in its custom folder.

Is this “Maven magic” able to resolve a dependency that is in a custom folder? :dizzy:


#12

Hi all,

Thank you so much for all the assistance.

I’m almost there…

I added a check for dependencies in the Java8 way that walks through every folder.

I am still however getting beautiful errors when building from Eclipse

  1. Maven was set to compile for Java 1.6, but I needed some Java 1.8 magic… I had to add
    `

    maven-compiler-plugin
    3.1
    1.8 1.8
` Otherwise I got `[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project imagej-maven-plugin: Compilation failure: Compilation failure: [ERROR] /Z:/biop/Personel/Olivier/Eclipse-Workspace/imagej-maven-plugin/src/main/java/net/imagej/maven/AbstractCopyJarsMojo.java:[229,35] lambda expressions are not supported in -source 1.6 [ERROR] (use -source 8 or higher to enable lambda expressions) `
  1. I had an error with Maven when trying to run the scripts that come as a part of this Artifact. It could not find mvn.bat because apparently in windows, the latest versions of Maven have it set to mvn.cmd. Duplicating the executable and renaming it mvn.bat fixed this issue.

  2. Right now the issue is that it cannot build the rest of the 7 goals…
    They all give me the following error
    [INFO] [ERROR] Could not find goal 'copy-jars' in plugin net.imagej:imagej-maven-plugin:0.7.0-SNAPSHOT among available goals install-artifact -> [Help 1] [INFO] org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'copy-jars' in plugin net.imagej:imagej-maven-plugin:0.7.0-SNAPSHOT among available goals install-artifact
    And here is the full dump
    https://pegasus.epfl.ch/view/247e11f2#54OITBEgbco9W09w0F27tkGutdJzyoDS


#13

That sounds reasonable to me…

Which branch have you used as starting point for your adventure (;-))?


#14

took your new branch copy-jar-subdirectory.

I merged fix-maven-issues before starting to work on it.


#15

Can you mvn install that branch or does it also fail?


#16

OK so it was a stupid bug on my part, where I missed to consider the case where the regex matcher found no match. A copy-paste error…

Anyways, it builds almost perfectly now

[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 5, Failed: 2, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  delete-other-versions\pom.xml
[ERROR] *  copy-jars\pom.xml
[INFO] -------------------------------------------------

Here is the error log from copy-jars

[INFO] ------------------------------------------------------------------------
Running post-build script: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\verify.bsh
Should contain 'Possibly incompatible version exists: Example_PlugIn-0.9.0-obsolete.jar':
> Running pre-build script: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\setup.bsh
> Finished pre-build script: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\setup.bsh
> [INFO] Error stacktraces are turned on.
> [INFO] Scanning for projects...
> [INFO] 
> [INFO] ------------------------------------------------------------------------
> [INFO] Building An example ImageJ 1.x plugin to test imagej-maven-plugin's CopyJarsMojo 1.0.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO] Downloading: file:///C:/Users/oburri/.m2/repository/junit/junit/4.8.1/junit-4.8.1.pom
> [INFO] Downloaded: file:///C:/Users/oburri/.m2/repository/junit/junit/4.8.1/junit-4.8.1.pom (949 B at 12 kB/s)
> [INFO] Downloading: file:///C:/Users/oburri/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar
> [INFO] Downloaded: file:///C:/Users/oburri/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar (237 kB at 5.4 MB/s)
> [INFO] 
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Example_PlugIn ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 1 resource
> [INFO] 
> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Example_PlugIn ---
> [INFO] Changes detected - recompiling the module!
> [INFO] Compiling 1 source file to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\classes
> [INFO] 
> [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Example_PlugIn ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] skip non existing resourceDirectory Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\src\test\resources
> [INFO] 
> [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Example_PlugIn ---
> [INFO] No sources to compile
> [INFO] 
> [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Example_PlugIn ---
> [INFO] No tests to run.
> [INFO] 
> [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Example_PlugIn ---
> [INFO] Building jar: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\Example_PlugIn-1.0.0-SNAPSHOT.jar
> [INFO] 
> [INFO] --- maven-install-plugin:2.4:install (default-install) @ Example_PlugIn ---
> [INFO] Installing Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\Example_PlugIn-1.0.0-SNAPSHOT.jar to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\local-repo\org\apache\maven\plugin\my\unit\Example_PlugIn\1.0.0-SNAPSHOT\Example_PlugIn-1.0.0-SNAPSHOT.jar
> [INFO] Installing Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\pom.xml to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\local-repo\org\apache\maven\plugin\my\unit\Example_PlugIn\1.0.0-SNAPSHOT\Example_PlugIn-1.0.0-SNAPSHOT.pom
> [INFO] 
> [INFO] --- imagej-maven-plugin:0.6.2:copy-jars (copy-jars) @ Example_PlugIn ---
> [INFO] Copying Example_PlugIn-1.0.0-SNAPSHOT.jar to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\ImageJ.app\plugins
> [INFO] Copying ij-1.48s.jar to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\ImageJ.app\jars
> [INFO] 
> [INFO] --- imagej-maven-plugin:0.6.2:install-artifact (install-artifact) @ Example_PlugIn ---
> [INFO] Downloading: http://maven.imagej.net/content/groups/public/junit/junit/4.8.1/junit-4.8.1.pom
> [INFO] Downloaded: http://maven.imagej.net/content/groups/public/junit/junit/4.8.1/junit-4.8.1.pom (0 B at 0 B/s)
> [INFO] Downloading: http://maven.imagej.net/content/groups/public/net/imagej/ij/1.48s/ij-1.48s.pom
> [INFO] Downloaded: http://maven.imagej.net/content/groups/public/net/imagej/ij/1.48s/ij-1.48s.pom (0 B at 0 B/s)
> [INFO] Downloading: http://maven.imagej.net/content/groups/public/org/scijava/pom-scijava/1.147/pom-scijava-1.147.pom
> [INFO] Downloaded: http://maven.imagej.net/content/groups/public/org/scijava/pom-scijava/1.147/pom-scijava-1.147.pom (0 B at 0 B/s)
> [INFO] Downloading: http://maven.imagej.net/content/groups/public/net/imagej/ij/1.48s/ij-1.48s.jar
> [INFO] Downloading: http://maven.imagej.net/content/groups/public/junit/junit/4.8.1/junit-4.8.1.jar
> [INFO] Downloaded: http://maven.imagej.net/content/groups/public/junit/junit/4.8.1/junit-4.8.1.jar (0 B at 0 B/s)
> [INFO] Downloaded: http://maven.imagej.net/content/groups/public/net/imagej/ij/1.48s/ij-1.48s.jar (0 B at 0 B/s)
> [INFO] Copying Example_PlugIn-1.0.0-SNAPSHOT.jar to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\Other.app\plugins
> [INFO] Copying ij-1.48s.jar to Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\Other.app\jars
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 4.639 s
> [INFO] Finished at: 2017-08-22T10:56:42+02:00
> [INFO] Final Memory: 25M/751M
> [INFO] ------------------------------------------------------------------------
> Running post-build script: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\verify.bsh

java.lang.RuntimeException: Failure!
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at bsh.Reflect.constructObject(Unknown Source)
	at bsh.BSHAllocationExpression.constructObject(Unknown Source)
	at bsh.BSHAllocationExpression.objectAllocation(Unknown Source)
	at bsh.BSHAllocationExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHThrowStatement.eval(Unknown Source)
	at bsh.BSHBlock.evalBlock(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BSHIfStatement.eval(Unknown Source)
	at bsh.BSHBlock.evalBlock(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BshMethod.invokeImpl(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.Name.invokeLocalMethod(Unknown Source)
	at bsh.Name.invokeMethod(Unknown Source)
	at bsh.BSHMethodInvocation.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHBlock.evalBlock(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BshMethod.invokeImpl(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.Name.invokeLocalMethod(Unknown Source)
	at bsh.Name.invokeMethod(Unknown Source)
	at bsh.BSHMethodInvocation.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at org.apache.maven.shared.scriptinterpreter.BeanShellScriptInterpreter.evaluateScript(BeanShellScriptInterpreter.java:116)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:249)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:177)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1692)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1360)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuilds(AbstractInvokerMojo.java:1210)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.execute(AbstractInvokerMojo.java:723)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

And from delete-other-versions

Running post-build script: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\delete-other-versions\verify.bsh
Should not exist: Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\delete-other-versions\target\ImageJ.app\plugins\Example_PlugIn-0.9.0-obsolete.jar
java.lang.RuntimeException: Failure!
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at bsh.Reflect.constructObject(Unknown Source)
	at bsh.BSHAllocationExpression.constructObject(Unknown Source)
	at bsh.BSHAllocationExpression.objectAllocation(Unknown Source)
	at bsh.BSHAllocationExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHThrowStatement.eval(Unknown Source)
	at bsh.BSHBlock.evalBlock(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BSHIfStatement.eval(Unknown Source)
	at bsh.BSHBlock.evalBlock(Unknown Source)
	at bsh.BSHBlock.eval(Unknown Source)
	at bsh.BshMethod.invokeImpl(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.BshMethod.invoke(Unknown Source)
	at bsh.Name.invokeLocalMethod(Unknown Source)
	at bsh.Name.invokeMethod(Unknown Source)
	at bsh.BSHMethodInvocation.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.BSHPrimaryExpression.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at bsh.Interpreter.eval(Unknown Source)
	at org.apache.maven.shared.scriptinterpreter.BeanShellScriptInterpreter.evaluateScript(BeanShellScriptInterpreter.java:116)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:249)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:177)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1692)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1360)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuilds(AbstractInvokerMojo.java:1210)
	at org.apache.maven.plugin.invoker.AbstractInvokerMojo.execute(AbstractInvokerMojo.java:723)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

#17

The plugin doesn’t detect other versions of the artifact you are trying to build anymore:

Should contain ‘Possibly incompatible version exists: Example_PlugIn-0.9.0-obsolete.jar’

The integration tests are located in src/it/. They are small Maven projects that are built with your custom version of imagej-maven-plugin. The setup.bsh creates a dummy ImageJ.app folder with e.g. some subfolders and empty JAR files. In case of the two failing tests, take a look in Z:\biop\Personel\Olivier\Eclipse-Workspace\imagej-maven-plugin\target\it\copy-jars\target\ImageJ.app\plugins, where you’ll find two files:

➜  plugins git:(copy-jar-sub-oli) ✗ ls -la
total 16
drwxrwxr-x 2 stefan stefan 4096 Aug 22 12:47 .
drwxrwxr-x 4 stefan stefan 4096 Aug 22 12:47 ..
-rw-rw-r-- 1 stefan stefan    0 Aug 22 12:47 Example_PlugIn-0.9.0-obsolete.jar
-rw-rw-r-- 1 stefan stefan 4240 Aug 22 12:47 Example_PlugIn-1.0.0-SNAPSHOT.jar

With delete.other.versions enabled in the POM of the copy-jars integration test, Example_PlugIn-0.9.0-obsolete.jar should be overwritten by Example_PlugIn-1.0.0-SNAPSHOT.jar which is not the case with your version of the plugin.

Hence, I’d suggest you come up with a new integration test that is similar to delete-others-versions. Copy that folder and take a look at the setup.bsh (setting up the ImageJ.app directory into which the project is installed) and the verify.bsh (which sets up the assumptions what that directory actually should look like).

We can also discuss possible test cases here and I can take a look at your code (thanks for putting it on GitHub!! :+1:)


#18

Are you extending pom-scijava or pom-scijava-base? They already change the source to 1.8, so that you do not have to…


#19

pom-scijava but scijava.jvm.version is set to 1.6. in imagej-maven-plugin's POM.


#20

So then the solution is to delete that line, not force override the compiler configuration.