Open BarchSteel opened 3 years ago
Thanks for reporting, @BarchSteel!
I cannot reproduce with my local clone, building with Maven 3.3.9 and Java 1.8.0_271 on Mac OSX, using:
mvn clean install
You can skip tests by running:
mvn -DskipTests
Please note however that it shouldn't be necessary at all for you to build this project. If you want to test modifications in any specific component (such as scifio
), just build that component only and put the built jar file into your up-to-date Fiji installation.
You can have Maven copy the jars and all dependencies by using:
mvn -Dscijava.app.directory=/path/to/your/Fiji.app
Thank you for the answer.
The problem is reproducible for me. I also tested on a different PC (also Windows 10, x64, same Eclipse Version), and the error is identical.
But your trick: -DskipTests worked! I created the .jar. (I entered it as "goal" in the menu for Run As->"2 Maven build..." and it seemed to work.)
I wanted to debug my changes in scifio, but I could not get the debugger to work correctly on my setup, unless I had both ImageJ and SCIFIO as projects set up. I also needed to disable the default SCIFIO dependency in the ImageJ project and manually add my scifio project to the class-path.
The reason that I could not copy over the sicfio.jar was, because building scifio.jar using the maven build process, also fails during the test, but of course with different code lines (I made a forum post for this, in case others struggle in the same way: https://forum.image.sc/t/trouble-compiling-scifio-from-git-repository/46695)
Looks like in both cases the services are not discovered (based on the forum post, the SCIFIO NullPointerException during the tests is thrown here). Running mvn test
on both repos (imagej/imagej
and scifio/scifio
) should work and it looks like in your case it doesn't. Maybe @tomburke-rse can help, he is a Windows user.
I set up a test build using the GitHub actions workflow to compile imagej on windows-latest and there it works without problems: https://github.com/BarchSteel/imagej/runs/1575995959?check_suite_focus=true
So the problem lies on my PC, either with Eclipse, or the JDK.
There is a longstanding bug in the EclipseHelper
code which runs the SciJava plugin indexer. Under some circumstances, the EclipseHelper
ends up writing the indexed plugins to target/META-INF/json/org.scijava.plugin.Plugin
, instead of the needed target/classes/META-INF/json/org.scijava.plugin.Plugin
. You can work around it by running mvn
manually on the CLI, then doing a refresh in Eclipse. I keep meaning to dig deeply into this bug and fix it, but haven't had time.
@BarchSteel I'm not certain your problem is the same as this, but I am quite suspicious. :wink:
It is unfortunate that we need this EclipseHelper
thing, but unfortunately Eclipse does not run annotation processors otherwise. (Yes, you can configure it to run individual ones on a per project basis, but it's clunky at best and requires special files committed to every repository. Whereas the EclipseHelper
solution—in theory at least—avoids community projects needing to care about this arcana.)
I installed the apache-maven-3.6.3 and used it on the command line in the ImageJ source directory.
mvn
Unfortunately, at first, the error message stayed the same.
For me, there were two different files.
\target\META-INF\json\org.scijava.plugin.Plugin
<-- does contain a reference to LitmusTest
\target\classes\META-INF\json\org.scijava.plugin.Plugin
<-- is missing the LitmusTest
The solution was to delete the complete target
folder and re-create it by running mvn
.
Now the test passed!
So this is not a maven problem, but an Eclipse IDE problem. If this could be fixed, it would it easier for newcomers to contribute to the project (I prefer Eclipse GUI over the CLI).
I was looking around to find this EclipseHelper
: maybe it's in here: https://github.com/scijava/scijava-maven-plugin
Just out of curiosity: How is scijava-maven-plugin referenced from imagej pom.xml? It seems the dependency goes like this: imagej->scijava-common -> scijava-base ->scijava-maven-plugin
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
https://forum.image.sc/t/trouble-compiling-scifio-from-git-repository/46695/2
How is scijava-maven-plugin referenced from imagej pom.xml?
The pom.xml
in imagej
directly inherits from its parent POM, pom-scijava
, which serves as a "bill of materials" (BOM) and itself has pom-scijava-base
as a parent.
Hello, I set up Eclipse, JDK8, cloned imagej/imagej, imported the project -> everything OK. I can also start & debug ImageJ 2.1.1-snapshot from with Eclipse. (go to net.imagej->main.java and Run As->Java App)
But I can't get the maven build to succeed to build the package or do an install. It will fail during the tests. What can I do to skip the tests? What is my mistake, so that I can build the package, or do a maven install? My goal is to create and test a stand-alone version for testing my modifications.