Plugin build failing due to maven-enforcer-plugin with pom-scijava >= 20.1.0

maven
imagej

#1

Hi everyone,

I am trying to port another of our lab’s plugins into the Scijava ecosystem and am encountering some difficulties in compiling the project in Maven. I am still learning Maven, so any help would be appreciated.

Problem

When I attempt to build the plugin with either mvn install, mvn compile, or mvn clean install I encounter the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-rules) on project DEFCoN_: Unable to parse configuration of mojo org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce for parameter ignoreClasses: Cannot assign configuration entry 'ignoreClasses' with value 'org.hibernate.stat.ConcurrentStatisticsImpl,org.junit.runner.Runner' of type java.lang.String to property of type java.lang.String[] -> [Help 1]

The error message suggests that the problem is not necessarily with my configuration but rather in another package that is trying to coerce a String into a String[].

Further information

  • The full error trace (using the -X argument to mvn) is here: https://www.dropbox.com/s/v4ftkzjvb3uk5kd/mvn_install_output.txt?dl=0
  • The plugin I wish to build is here: https://github.com/LEB-EPFL/DEFCoN-ImageJ
  • The pom.xml on the GitHub repo is outdated and also problematic. The most recent one that raises these errors is here: https://www.dropbox.com/s/vj58v3g608opxwz/pom.xml?dl=0
  • I get this error for any pom-scijava above 20.0.0.
  • In the pom.xml I have pinned Tensorflow at version 1.5.0 because the code will not work with 1.6.0
  • I have tried completely deleting my .m2 repository folder and rebuilding the project but still receive the same error.
  • If I use pom-scijava 19.2.0, then the .jar will be successfully built and is functional. However, it fails at the install phase when copying jars into my Fiji.app folder with a failure to find edu.ucar:udunits:jar:4.3.18.
  • If I use pom-scijava 20.0.0, I get an incompatible types error related to passing java.lang.Float to a org.tensorflow.Tensor<> generic.

Maven version

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100) Maven home: /home/kmdouglass/apps/netbeans-8.2/java/maven Java version: 1.8.0_171, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-oracle/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.13.0-39-generic", arch: "amd64", family: "unix"

Java version

java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Final thoughts

I fully accept that I could just be doing something obviously wrong or misunderstanding something fundamental to how Maven works. Could anyone point me in the right direction or suggest something else to try so I can get this plugin built without problems?

Thanks a lot!
-kmd


#2

This error is due to pom-scijava using a feature of Maven available from versions 3.3.9 and later.

It’s been fixed in pom-scijava version 21.0.0 by @ctrueden in this commit:

As the commit message says, you’ll have to update your maven version, but Maven will tell you a more informative error message when you use version 21.0.0 as parent.

(For some related discussion, see the gitter posts starting here.)


#3

Thanks as always @imagejan! I should have considered this as a problem but I guess I was too buried into the details to have thought about it.

BTW, the Maven 3.0.5 version that I am using is the default version of Maven that comes packaged with Netbeans 8.2 for Linux. If anyone else happens upon this post with the same problem and is using Netbeans, consider checking the Maven version while troubleshooting.


#4

This is just a quick follow-up since the pom-scijava for Fiji was just upgraded, meaning that Netbeans 8.2 no longer works out-of-the-box for Fiji development.

Netbeans users who want to continue to develop for Fiji can upgrade the version of Maven linked to Netbeans by following these steps:

  1. Install a newer version of Maven on your system, eg. 3.3.9.
  2. Open Netbeans.
  3. Navigate to Tools > Options.
  4. Select Java
  5. Click the Maven tab.
  6. In the Maven Home drop-down box, select Browse…
  7. Navigate to the Maven installation directory. On Debian Jessie, this is /usr/share/maven
  8. Click OK.

You may need to restart Netbeans, though all I had to do was rebuild my projects via the command line outside of Netbeans to get everything to work correctly.

Cheers,
kmd


#5

Thanks @kmdouglass! Would you be willing to update the documentation at https://imagej.net/NetBeans ?


#6

@imagejan @ctrueden

I am sometimes using jitpack.io to use github repos as maven dependencies, like so:


However it seems they are using a too old version of maven (3.2.5) to build the jars from the repos and then the build fails due to the reason discussed here.
See e.g., here: https://jitpack.io/com/github/tischi/fiji-plugin-bigDataTools/dd35f382c9/build.log

I tried to find out how to change the maven version that jitpack is using but could not figure it out. Does one of you by chance know how to fix this?


#7

You’re welcome @ctrueden. I will make the updates within the next few days.


#8

I encountered the same problem with Jitpack when the Fiji pom was upgraded. Unfortunately, I found no solution but to move my jars to a repository on Maven Central. I don’t think there’s anything we can do about Jitpack unless they upgrade their servers :frowning:

-kmd


#9

@Christian_Tischer, @kmdouglass did you see that paragraph linking to Maven Wrapper on the jitpack docs:

If your project requires a specific Maven version then you can use the Maven Wrapper. In that case JitPack will run:

./mvnw install -DskipTests

Maybe this helps?


We have maven.imagej.net if you do not want to put artifacts directly on Maven Central (with signing them correctly etc.). The SciJava scripts allow for continuous integration and Maven deployment (via Travis) on every GitHub commit of your master branch.

See the Travis wiki page:

@Christian_Tischer maybe switching to Travis would be an option for you that is (currently) better supported by the community?!


#10

Thanks @imagejan ! I don’t know how I missed that part of the Jitpack docs, but I appreciate you pointing it out!