Subject: bug#31943: closed (Re: bug#31943: Some Maven bugs)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 05 Jul 2018 04:44:02 +0000

Your bug report

#31943: Some Maven bugs

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
31943: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31943
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#31943: Some Maven bugs
From: Björn Höfling <[email-masked]>
To: Julien Lepiller <[email-masked]>
Cc: [email-masked]
Date: Thu, 5 Jul 2018 06:42:49 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Julien,

On Wed, 4 Jul 2018 22:06:08 +0200
Julien Lepiller <[email-masked]> wrote:

> Le Sat, 23 Jun 2018 00:39:35 +0200,
> Björn Höfling <[email-masked]> a écrit :
> 
> > Maven is now part of Guix, yeah! I gave it a try and found some bugs
> > which I post collectively here. I don't know yet where exactly they
> > come from and if they are trivial or not to fix. So if you think
> > they should better go each into a separate bug report, please
> > separate them.
> > 
> > [...]
> > 
> > 6) Maven does not compile Java 1.8 code.
> >   
> 
> This should be fixed in 892a5647debc7fe8eafac4f725c46134eb085b63.
> 
> I was cramming the whole set of dependencies for maven in the
> classpath, but it seems it doesn't play well with downloaded plugins.
> Now I generated a m2.conf file with multiple "load" lines to tell
> plexus-classworlds where to find the required jar files.

Great, works!

> > 7) I have some trouble executing the tests. This is indeterministic
> > (!), sometimes is is successful, sometimes I get an error:
> >   
> 
> So I've tested this, and it turns out it's not our package's fault: it
> fails undeterministically also when using the system's maven. I fixed
> it by downgrading maven-surefire-plugin version to 2.20 instead of
> 2.20.1.

I wondered that there is no commit for this an then realized that I have
to do that on my own in the pom.xml for each project, because Maven will
download its plugins:

<build> 
  <pluginManagement>
    <plugin>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.20</version>
    </plugin>
     ...
</build>

> Thank you for your reports! Do you think we can close this report now?

Thanks for fixing so quickly. Yes, closing with this message.

Björn

Subject: Some Maven bugs
From: Björn Höfling <[email-masked]>
To: <[email-masked]>
Date: Sat, 23 Jun 2018 00:39:35 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Maven is now part of Guix, yeah! I gave it a try and found some bugs
which I post collectively here. I don't know yet where exactly they
come from and if they are trivial or not to fix. So if you think they
should better go each into a separate bug report, please separate them.

For reference, I'm on Ubuntu with:

$> guix pull --list-generations | tail --lines=6
guile: warning: failed to install locale
warning: failed to install locale: Invalid argument

Generation 2    Jun 22 2018 21:53:40    (current)
  guix 18ab54d
    repository URL: https://git.savannah.gnu.org/git/guix.git
    commit: 18ab54d4a2aaf932b14e69c30650c1d2c4db33c7

1) The following propagated inputs are used from bash scripts
and are missing: which, coreutils

$> guix environment -C --ad-hoc maven icedtea@3:jdk -- mvn 
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 46: uname: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 56: ls: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 57: expr: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 58: expr: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 61: dirname: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 67: dirname: command not found
/gnu/store/sk23y72hma8x6n5ch6xqgql1q93dg7if-profile/bin/mvn: line 94: which: command not found
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

2) There is something wrong with the version output:

$> guix environment -C --ad-hoc maven icedtea@3:jdk coreutils which --
mvn -version

null <version unknown>
${distributionShortName} home: /gnu/store/a19m087lz9fg4c2aplvdlm1y2iiibjdb-maven-3.5.3
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /gnu/store/7dah2ha88f4sxakpgdlbfn6mvs842j6w-icedtea-3.7.0-jdk/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-128-generic", arch: "amd64", family: "unix"

Compare this to my "native" Ubuntu maven:

$> /usr/bin/mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /gnu/store/8yfdmh7hsnfq87ddcyjz5nxk5f208pmc-icedtea-3.7.0-jdk/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-128-generic", arch: "amd64", family: "unix"

3) The -version part is already handled by Java code. So I tried to
debug Maven remotely from Eclipse, but it failed with a message saying
that debug symbols were missing. I want to verify this again, but could
this be a problem of the ant-build-system removing debug symbols?

4) I cannot use icedteaX (x \in {1,2}) (i.e. X=2 means JDK 1.7) with
Maven. Is this a bug or a fact?

$> guix environment -C --ad-hoc maven icedtea@2:jdk coreutils which --
mvn -version

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(Unknown Source)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(Unknown Source)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Unknown Source)

Version 52.0 means Java 1.8. I think this is because we are now building
all Java packages with ant-build-system with Icedtea@3 and letting it
output Java8 code. Right?

If this is the case anyway, we don't have any chance to choose a JDK to
run maven with (if we choose from Guix, not from other locations).
Should we then add icedtea@3 as a propagated input to maven? Then a
user can directly use Maven and doesn't have to think of installing a
JDK first. Mhm, maybe too strict and too heavy in size?

From now on I'm in a container with a fresh .m2 directory,
assuming "mvn-home" is an empty directory:

guix environment -C -N --share=mvn-home/=/home/bjoern/.m2 --ad-hoc maven coreutils which icedtea@3:jdk

5) Maven complains about the logger output:

$ENV> mvn clean install
[WARNING] The SLF4J binding actually used is not supported by Maven: org.slf4j.impl.SimpleLoggerFactory
[WARNING] Maven supported bindings are:
[INFO] Scanning for projects...
[...]

When looking at the package definition of maven, I find in the inputs:

       ;; TODO: replace with maven-slf4j-provider
       ("java-slf4j-simple" ,java-slf4j-simple)))

Is this comment related to the WARNING? Will it go away with
maven-slf4j-provider?

6) Maven does not compile Java 1.8 code.

To reproduce this, build any Maven project that has either source or
target language version set to 1.8:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

As our Maven mostly works, you can just use:

$ENV> mvn archetype:generate

to create a new Maven project. Edit the pom.xml to set the versions.

Then [I head some problems with tests, so skipping them here]:

$ENV> mvn clean install -Dmvn.tests.skip=true -X -e

[..]

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.171 s
[INFO] Finished at: 2018-06-22T22:17:21Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project tst2: Fatal error compiling: invalid source release: 1.8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project tst2: Fatal error compiling
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Unknown Source)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Unknown Source)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(Unknown Source)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Unknown Source)
	at org.apache.maven.DefaultMaven.doExecute(Unknown Source)
	at org.apache.maven.DefaultMaven.doExecute(Unknown Source)
	at org.apache.maven.DefaultMaven.execute(Unknown Source)
	at org.apache.maven.cli.MavenCli.execute(Unknown Source)
	at org.apache.maven.cli.MavenCli.doMain(Unknown Source)
	at org.apache.maven.cli.MavenCli.main(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Unknown Source)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Unknown Source)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Unknown Source)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Unknown Source)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1086)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Unknown Source)
	... 21 more
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid source release: 1.8
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:173)
	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1075)
	... 23 more
Caused by: java.lang.IllegalArgumentException: invalid source release: 1.8
	at com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:88)
	at com.sun.tools.javac.main.RecognizedOptions$9.process(RecognizedOptions.java:348)
	at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:242)
	at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
	at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
	... 25 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

7) I have some trouble executing the tests. This is indeterministic (!),
sometimes is is successful, sometimes I get an error:

$ENV> mvn clean install -X -e -B>stacktrace.log 2>&1; echo $?

[..]

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running de.xxx.AppTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.981 s
[INFO] Finished at: 2018-06-22T22:27:49Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project tst2: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/bjoern/x/z/tst2/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/bjoern/x/z/tst2 && /gnu/store/7dah2ha88f4sxakpgdlbfn6mvs842j6w-icedtea-3.7.0-jdk/jre/bin/java -jar /home/bjoern/x/z/tst2/target/surefire/surefirebooter4025948542605868366.jar /home/bjoern/x/z/tst2/target/surefire 2018-06-22T22-27-48_542-jvmRun1 surefire4165566371678934740tmp surefire_02394075698289798736tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/bjoern/x/z/tst2 && /gnu/store/7dah2ha88f4sxakpgdlbfn6mvs842j6w-icedtea-3.7.0-jdk/jre/bin/java -jar /home/bjoern/x/z/tst2/target/surefire/surefirebooter4025948542605868366.jar /home/bjoern/x/z/tst2/target/surefire 2018-06-22T22-27-48_542-jvmRun1 surefire4165566371678934740tmp surefire_02394075698289798736tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:686)
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535)
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280)
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
[ERROR] 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(Unknown Source)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Unknown Source)
[ERROR] 	at org.apache.maven.DefaultMaven.doExecute(Unknown Source)
[ERROR] 	at org.apache.maven.DefaultMaven.doExecute(Unknown Source)
[ERROR] 	at org.apache.maven.DefaultMaven.execute(Unknown Source)
[ERROR] 	at org.apache.maven.cli.MavenCli.execute(Unknown Source)
[ERROR] 	at org.apache.maven.cli.MavenCli.doMain(Unknown Source)
[ERROR] 	at org.apache.maven.cli.MavenCli.main(Unknown Source)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Unknown Source)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Unknown Source)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Unknown Source)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Unknown Source)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project tst2: There are test failures.
[..]

8) BTW maven is NOT creating a reproducible output. That's important if
you want to use it to as a build tool for Guix:

$ENV> jar tvvf
~/.m2/repository/de/xxx/tst2/1.0-SNAPSHOT/tst2-1.0-SNAPSHOT.jar

 110 Fri Jun 22 22:29:26 GMT 2018 META-INF/MANIFEST.MF
   0 Fri Jun 22 22:29:26 GMT 2018 META-INF/

That's it for now. 

Björn