Scijava-maven-plugin copy-jars fails with "Couldn't determine scijava.app.subdirectory" errors

[ERROR] Failed to execute goal org.scijava:scijava-maven-plugin:1.1.1:copy-jars (copy-jars) on project bonej-ops: Couldn't determine scijava.app.subdirectory for com.miglayout:miglayout:jar:swing:3.7.4: Some problems were encountered while processing the POMs:
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 138, column 18
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 155, column 18
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 172, column 18
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 232, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 243, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jxr-plugin is missing. @ line 383, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.geronimo.genesis.plugins:tools-maven-plugin is missing. @ line 218, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:retrotranslator-maven-plugin is missing. @ line 388, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 416, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 430, column 21
[ERROR] [WARNING] The expression ${version} is deprecated. Please use ${project.version} instead. @: 11 problems were encountered while building the effective model for com.miglayout:miglayout:3.7.4
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 138, column 18
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 155, column 18
[ERROR] [ERROR] 'profiles.profile.id' must be unique but found duplicate profile with id default @ line 172, column 18
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 232, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 243, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jxr-plugin is missing. @ line 383, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.geronimo.genesis.plugins:tools-maven-plugin is missing. @ line 218, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:retrotranslator-maven-plugin is missing. @ line 388, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 416, column 21
[ERROR] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 430, column 21
[ERROR] [WARNING] The expression ${version} is deprecated. Please use ${project.version} instead. @
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :bonej-ops

This is when running the BoneJ development build and install script, relevant line:

mvn -Dscijava.app.directory="$1" clean install

I’ve tried emptying my .m2 directory to force all the packages to refresh. Looks like some kind of configuration error that is affecting lots of upstream packages. Any ideas @ctrueden @alessandrofelder @rimadoma?

Working around this for the moment with:

find . -name "*SNAPSHOT.jar" -type  f -exec cp {} ../../Fiji.app.dev/jars/ \;

I found a related issue, which basically says that the copy-jars fails because some artefacts have weird naming schemes.

I tried the standard trick of finding where the transient dependency com.miglayout:miglayout comes from with mvn dependency:tree, and then excluding it where needed with e.g.

            <groupId>net.imagej</groupId>
            <artifactId>imagej</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.miglayout</groupId>
                    <artifactId>miglayout</artifactId>
                </exclusion>
            </exclusions> 

However, this made every single one of our wrapper test classes blurt out [ERROR] java.lang.NoClassDefFoundError: net/miginfocom/swing/MigLayout, because they call new ImageJ(). This would be only an annoyance, since the tests still passed, but what really makes the workaround unviable is that it breaks launching ImageJ from your IDE with imageJ = new ImageJ(); imagej.launch().

Since the issue seems pretty old, I don’t think we can roll back our dependencies to old enough versions either. For now we might just have to continue with your workaround. The issue shouldn’t affect BoneJ users, because the Maven plugin that copies JARs from the local Maven repository to the Fiji.app directory is not called when launching the Fiji updater.

P. S. You can see from the issue that I updated that there are other transient dependencies that produce the same error. As far as I could tell, excluding them didn’t cause problems.

This works as long as BoneJ doesn’t declare explicit version numbers for any of its (non-test) dependencies. Which we don’t at the moment. But as soon as we add something like

        <dependency>
            <groupId>net.imagej</groupId>
            <artifactId>imagej-ops</artifactId>
            <version>"Newer-than-in-pom-scijava"</version>
        </dependency>

The script needs to copy that too to be certain that everything works A-OK.

OK, you can disregard some of what I said earlier. @ctrueden rode to rescue, and figured that after excluding com.miglayout.miglayout you can add a dependency to com.miglayout:miglayout-swing:5.2, which makes things run smoothly. I added a PR which fixes the issue (because I don’t seem to be able to push to master any more).

2 Likes

@rimadoma Glad you found a working solution. In general, it is certainly true that the behavior of scijava-maven-plugin needs to change to be more tolerant of faulty POMs in the dependency tree. Otherwise, this is just going to keep happening. As part of the pom-scijava 29 work, I created a new all-inclusive melting pot build tentatively dubbed “mega melt”, which I’m planning to hook up to the CI. Once scijava/scijava-maven-plugin#21 is addressed, we should consider including a scijava-maven-plugin copy-jars execution as part of the CI validation there.

2 Likes

I had the same issue (miglayout) with pom scijava 28.0.0 . I excluded the miglayout dependency but I now get this:

[ERROR] Failed to execute goal org.scijava:scijava-maven-plugin:1.1.1:copy-jars (copy-jars) on project bigdataviewer-playground: Couldn't determine scijava.app.subdirectory for org.scala-lang.modules:scala-xml_2.12:jar:1.0.6: Some problems were encountered while processing the POMs:

So I excluded this scala dependency but then I get:

[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-surefire-plugin].dependencies.dependency.version' for org.mortbay.jetty.alpn:alpn-boot:jar must be a valid version but is '${alpn.jdk8.version}'. 

This looks a bit endless… so I’ll revert to pom scijava 27.0.1.

But if someone has a solution this would be beautiful.

1 Like

This error is fixed in scijava-maven-plugin 2.0.0. You will need a new pom-scijava to use it (it’s not enough to just update scijava-maven-plugin.version, because the goal name changed). You can either use the bleeding-edge pom-scijava 29.0.0-beta-1, or you can wait for pom-scijava 29.0.0 to be released Very Soon™!

1 Like