imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
513 stars 218 forks source link

Problems with importing packages - Maven Build #230

Open bioramonmoratori opened 7 months ago

bioramonmoratori commented 7 months ago

Bugs

When I tried to build the application using Maven, I encountered some import errors in the POM.xml file. The dependencies are:

Affected Classes and Possible Fixes

pom-scijava 31.1.0:

scijava

JUnit

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.13.2</version>
  <scope>test</scope>
</dependency>

Folder /ImageJ/tests experiencing import issues with various classes:

Even so, some classes from the "tests" folder cannot import the "Loci" dependency. Even after deleting these classes, many JUnit tests start to fail, and some classes show deprecation warnings.

What should be done:

By making these changes, the expectation is that the Maven build will return to functioning normally.

ctrueden commented 7 months ago

@bioramonmoratori Thank you for the detailed report.

Could you please comment on the versions of Maven and OpenJDK that you are using? For example, on my system:

$ mvn -v
Apache Maven 3.8.7
Maven home: /usr/share/maven
Java version: 11.0.20.1, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.5.0-10-generic", arch: "amd64", family: "unix"

With this combination, as well as other versions of OpenJDK I tested, I am able to build ImageJ without the problems you describe, simply by typing mvn at the command line.

Based on your screenshot above, I get the impression somehow that you are not using the Maven command line tool, but maybe some other tool? If so, what is it?

About the specific points you raise:

pom-scijava: version 31.1.0

This parent version works just fine for me. Using 37.0.0 is also fine, and we can certainly update it, but I don't believe there is an urgent reason to do so for this project.

junit: no specific version

The version of junit should not be specified here. Rather, it is inherited from the parent POM via its depenencyManagement section. This is the purpose of the SciJava Bill of Materials.

loci: missing dependency

Yes, some of the tests are currently written to use Bio-Formats to import images. This is less than ideal. However, the tests are currently disabled in the pom.xml, so these errors should not matter. I have not fixed this issue yet due to lack of time, as there are currently many failing tests.