opengeospatial / ets-cat30

OGC Catalogue 3.0 Conformance Test Suite
Other
0 stars 6 forks source link

Cannot build using Java11 #36

Closed PissedCapslock closed 5 years ago

PissedCapslock commented 6 years ago

Running mvn install when using OpenJDK11:

java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
mvn -version
Apache Maven 3.5.2
Maven home: /usr/share/maven
Java version: 11.0.1, vendor: Oracle Corporation
Java home: /java/openjdk-11.0.1
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-39-generic", arch: "amd64", family: "unix"

results in errors like

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

This is caused by the fact that on Java11, certain classes have been removed from the JDK. The fix for this is trivial. Just add the following dependencies to the pom.xml file.

    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-core</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1.1</version>
    </dependency>

That is however not sufficient to be able to run the tests. Doing mvn install with that fix results in

java.lang.IllegalArgumentException: org.opengis.util.NameFactory is not an ImageIO SPI class
    at java.desktop/javax.imageio.spi.ServiceRegistry.checkClassAllowed(ServiceRegistry.java:722)
    at java.desktop/javax.imageio.spi.ServiceRegistry.<init>(ServiceRegistry.java:117)
    at org.geotoolkit.factory.FactoryRegistry.<init>(FactoryRegistry.java:165)
    at org.geotoolkit.factory.FactoryRegistry.<init>(FactoryRegistry.java:156)

This is caused by https://bugs.openjdk.java.net/browse/JDK-8068749. The geotools bugtracker indicates this is fixed: https://osgeo-org.atlassian.net/browse/GEOT-5289. However, the libraries on which this repo depends look like a very old version of geotools of which the latest version was published on Maven in 2015.

dstenger commented 5 years ago

Thank you for reporting.

As TEAM Engine must be built and run with Java 8 [1], there is an implicit requirement to also build and run test suites with Java 8. Can you please check if the errors also occur when using Java 8 (following you description, I guess, Java 8 works)?

However, I agree that it should be documented more clear what Java versions are supported by test suites (e.g. by configuring Maven compiler plugin and/or Maven enforcer plugin).

Also, a general plan must be developed to migrate TEAM Engine to newer Java versions.

[1] http://opengeospatial.github.io/teamengine/installation.html

PissedCapslock commented 5 years ago

Java8 indeed works.