[all] Maven Build with Java 10/11?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[all] Maven Build with Java 10/11?

Stefan Bodewig
Hi all

I wanted to see whether anything was broken in COMPRESS with the Java10
RC or the EA version of Java11 - unfortunately the build fails with
NullPointerException inside of Surefire.

I run

$ mvn clean test '-P!jacoco'

as Jacoco doesn't seem to work for Java10+ either. I end up with

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project commons-compress: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]
[ERROR]

The stack trace I see with -X gets me to

Caused by: java.lang.NullPointerException
        at org.apache.maven.surefire.shade.org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(SystemUtils.java:1626)

which I'm afraid has just been fixed a few days ago for Java11.

IIUC this means it is impossible to run tests with Maven on Java11+ at
all until we (1) cut a new release of LANG and (2) get Surefire to use
that.

For Java10 I'd probably need to force Surefire to use LANG in version
3.7 (which according to the changelog fixes the NPE). I thought I'd add
an explicit dependency on lang 3.7 inside pluginManagement. Doing so I
see maven download LANG 3.7 but I still run into the same NPE. Obviously
Surefire does still use a different version of LANG as the line number
for the NPE is still the same, but this is a comment line inside the 3.7
tag.

Here is what I tried in COMPRESS' pom and still get the NPE with Java10:

@@ -253,6 +253,18 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
           <artifactId>maven-bundle-plugin</artifactId>
           <version>${commons.felix.version}</version>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>${commons.surefire.version}</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.commons</groupId>
+              <artifactId>commons-lang3</artifactId>
+              <version>3.7</version>
+            </dependency>
+          </dependencies>
+        </plugin>
       </plugins>
     </pluginManagement>
     <plugins>

Any ideas?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [all] Maven Build with Java 10/11?

jodastephen
Just to note that surefire v2.21.0 is out now. No idea if that helps.
Stephen

On 9 March 2018 at 08:22, Stefan Bodewig <[hidden email]> wrote:

> Hi all
>
> I wanted to see whether anything was broken in COMPRESS with the Java10
> RC or the EA version of Java11 - unfortunately the build fails with
> NullPointerException inside of Surefire.
>
> I run
>
> $ mvn clean test '-P!jacoco'
>
> as Jacoco doesn't seem to work for Java10+ either. I end up with
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project commons-compress: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]
> [ERROR]
>
> The stack trace I see with -X gets me to
>
> Caused by: java.lang.NullPointerException
>         at org.apache.maven.surefire.shade.org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(SystemUtils.java:1626)
>
> which I'm afraid has just been fixed a few days ago for Java11.
>
> IIUC this means it is impossible to run tests with Maven on Java11+ at
> all until we (1) cut a new release of LANG and (2) get Surefire to use
> that.
>
> For Java10 I'd probably need to force Surefire to use LANG in version
> 3.7 (which according to the changelog fixes the NPE). I thought I'd add
> an explicit dependency on lang 3.7 inside pluginManagement. Doing so I
> see maven download LANG 3.7 but I still run into the same NPE. Obviously
> Surefire does still use a different version of LANG as the line number
> for the NPE is still the same, but this is a comment line inside the 3.7
> tag.
>
> Here is what I tried in COMPRESS' pom and still get the NPE with Java10:
>
> @@ -253,6 +253,18 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
>            <artifactId>maven-bundle-plugin</artifactId>
>            <version>${commons.felix.version}</version>
>          </plugin>
> +        <plugin>
> +          <groupId>org.apache.maven.plugins</groupId>
> +          <artifactId>maven-surefire-plugin</artifactId>
> +          <version>${commons.surefire.version}</version>
> +          <dependencies>
> +            <dependency>
> +              <groupId>org.apache.commons</groupId>
> +              <artifactId>commons-lang3</artifactId>
> +              <version>3.7</version>
> +            </dependency>
> +          </dependencies>
> +        </plugin>
>        </plugins>
>      </pluginManagement>
>      <plugins>
>
> Any ideas?
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [all] Maven Build with Java 10/11?

Stefan Bodewig
On 2018-03-09, Stephen Colebourne wrote:

> Just to note that surefire v2.21.0 is out now. No idea if that helps.
> Stephen

It does, many thanks.

Strangely it also helps with Java11, so I guess the newer Surefire
doesn't use SystemUtils.isJavaVersionAtLeast anymore.

I'll update commons-parent.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [all] Maven Build with Java 10/11?

Stefan Bodewig
On 2018-03-09, Stefan Bodewig wrote:

> On 2018-03-09, Stephen Colebourne wrote:

>> Just to note that surefire v2.21.0 is out now. No idea if that helps.
>> Stephen

> I'll update commons-parent.

Somebody else already did.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]