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

maven
Tags: #<Tag:0x00007fa30bb65e08>

#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