saucelabs / sauce-java

A set of helpers for consuming Sauce Labs services from Java
Apache License 2.0
45 stars 61 forks source link

sauce-connect-plugin fails maven builds on JDK9 #49

Open vlukashov opened 7 years ago

vlukashov commented 7 years ago

When trying to build a maven project that includes the sauce-connect-plugin on JDK9, the build fails with Execution start-sauceconnct of goal com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect failed: A required class was missing while executing com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect: javax/xml/bind/DatatypeConverter.

The same build passes just fine on JDK8.

$ java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
$ mvn verify
...
[ERROR] Failed to execute goal com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect (start-sauceconnct) on project sauce-connect-plugin-jdk9: Execution start-sauceconnct of goal com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect failed: A required class was missing while executing com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23:start-sauceconnect: javax/xml/bind/DatatypeConverter
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.saucelabs.maven.plugin:sauce-connect-plugin:2.1.23
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/viktor/.m2/repository/com/saucelabs/maven/plugin/sauce-connect-plugin/2.1.23/sauce-connect-plugin-2.1.23.jar
[ERROR] urls[1] = file:/Users/viktor/.m2/repository/com/saucelabs/ci-sauce/1.129/ci-sauce-1.129.jar
[ERROR] urls[2] = file:/Users/viktor/.m2/repository/org/codehaus/plexus/plexus-archiver/3.4/plexus-archiver-3.4.jar
[ERROR] urls[3] = file:/Users/viktor/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
[ERROR] urls[4] = file:/Users/viktor/.m2/repository/org/codehaus/plexus/plexus-io/2.7.1/plexus-io-2.7.1.jar
[ERROR] urls[5] = file:/Users/viktor/.m2/repository/org/apache/commons/commons-compress/1.11/commons-compress-1.11.jar
[ERROR] urls[6] = file:/Users/viktor/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[7] = file:/Users/viktor/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
[ERROR] urls[8] = file:/Users/viktor/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/Users/viktor/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar
[ERROR] urls[10] = file:/Users/viktor/.m2/repository/org/json/json/20160212/json-20160212.jar
[ERROR] urls[11] = file:/Users/viktor/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
[ERROR] urls[12] = file:/Users/viktor/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
[ERROR] urls[13] = file:/Users/viktor/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar
[ERROR] urls[14] = file:/Users/viktor/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
[ERROR] urls[15] = file:/Users/viktor/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[16] = file:/Users/viktor/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar
[ERROR] urls[17] = file:/Users/viktor/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[18] = file:/Users/viktor/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[19] = file:/Users/viktor/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar
[ERROR] urls[20] = file:/Users/viktor/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[21] = file:/Users/viktor/.m2/repository/com/saucelabs/sauce-connect/3.1.32/sauce-connect-3.1.32.jar
[ERROR] urls[22] = file:/Users/viktor/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
[ERROR] urls[23] = file:/Users/viktor/.m2/repository/com/saucelabs/saucerest/1.0.32/saucerest-1.0.32.jar
[ERROR] urls[24] = file:/Users/viktor/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
[ERROR] urls[25] = file:/Users/viktor/.m2/repository/org/apache/httpcomponents/httpclient/4.5/httpclient-4.5.jar
[ERROR] urls[26] = file:/Users/viktor/.m2/repository/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar
[ERROR] urls[27] = file:/Users/viktor/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
[ERROR] urls[28] = file:/Users/viktor/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : javax.xml.bind.DatatypeConverter
...

The full source of the project is attached: sauce-connect-plugin-jdk9.zip.

To reproduce the issue download and extract the source code, then run mvn verify inside it. The expected result is that the sauce connect plugin starts and complains that the Sauce Labs username is not set:

Nov 20, 2017 2:44:57 PM com.saucelabs.saucerest.SauceREST retrieveResults
SEVERE: Error retrieving Sauce Results
java.io.IOException: Server returned HTTP response code: 401 for URL: https://saucelabs.com/rest/v1/YOUR_SAUCE_USERNAME/tunnels
johannesh2 commented 6 years ago

As a work-around you can add jaxb-api explicitly as a dependency for sauce-connect-plugin

<plugin>
    <groupId>com.saucelabs.maven.plugin</groupId>
    <artifactId>sauce-connect-plugin</artifactId>
.
.
.
    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
    </dependencies>
</plugin>