Bug#910093: maven-compiler-plugin: tests fail due to hardcoded junit jar path and missing JAVA_HOME

2018-10-02 Thread Tiago Daitx
Please consider the attached patch.
diff -Nru maven-compiler-plugin-3.8.0/debian/changelog maven-compiler-plugin-3.8.0/debian/changelog
--- maven-compiler-plugin-3.8.0/debian/changelog	2018-07-30 09:26:41.0 +0200
+++ maven-compiler-plugin-3.8.0/debian/changelog	2018-09-21 14:45:48.0 +0200
@@ -1,3 +1,12 @@
+maven-compiler-plugin (3.8.0-2) UNRELEASED; urgency=low
+
+  * Fix tests: (Closes: #910093)
+- debian/rules: set JAVA_HOME to prevent compiler test failure.
+- debian/patches/01-fix-wrong-junit-path.patch: patch wrong junit path in
+  compiler test.
+
+ -- Tiago Stürmer Daitx   Fri, 21 Sep 2018 12:45:48 +
+
 maven-compiler-plugin (3.8.0-1) unstable; urgency=medium
 
   * Team upload.
diff -Nru maven-compiler-plugin-3.8.0/debian/patches/01-fix-wrong-junit-path.patch maven-compiler-plugin-3.8.0/debian/patches/01-fix-wrong-junit-path.patch
--- maven-compiler-plugin-3.8.0/debian/patches/01-fix-wrong-junit-path.patch	1970-01-01 01:00:00.0 +0100
+++ maven-compiler-plugin-3.8.0/debian/patches/01-fix-wrong-junit-path.patch	2017-09-08 20:32:01.0 +0200
@@ -0,0 +1,21 @@
+Description: Fix wrong junit patch in Compiler test.
+ The compiler testcase sets an absolute path to junit's jar file
+ version 3.8.1 even though the pom.xml file now depends on 4.12
+ (4.x on Debian).
+ .
+ This patch fixes it and set the fixed path to a current junit jar
+ file.
+Author: Tiago Stürmer Daitx 
+Last-Update: 2017-09-08
+
+--- maven-compiler-plugin-3.6.2.orig/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
 maven-compiler-plugin-3.6.2/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
+@@ -397,7 +397,7 @@ public class CompilerMojoTestCase
+ String localRepository = System.getProperty( "localRepository" );
+ if ( localRepository != null )
+ {
+-artifactFile = new File( localRepository, "junit/junit/3.8.1/junit-3.8.1.jar" );
++artifactFile = new File( localRepository, "junit/junit/4.x/junit-4.x.jar" );
+ }
+ else
+ {
diff -Nru maven-compiler-plugin-3.8.0/debian/patches/series maven-compiler-plugin-3.8.0/debian/patches/series
--- maven-compiler-plugin-3.8.0/debian/patches/series	1970-01-01 01:00:00.0 +0100
+++ maven-compiler-plugin-3.8.0/debian/patches/series	2017-09-08 20:32:01.0 +0200
@@ -0,0 +1 @@
+01-fix-wrong-junit-path.patch
diff -Nru maven-compiler-plugin-3.8.0/debian/rules maven-compiler-plugin-3.8.0/debian/rules
--- maven-compiler-plugin-3.8.0/debian/rules	2018-07-30 01:26:57.0 +0200
+++ maven-compiler-plugin-3.8.0/debian/rules	2018-07-30 18:57:55.0 +0200
@@ -1,4 +1,5 @@
 #!/usr/bin/make -f
+export JAVA_HOME=/usr/lib/jvm/default-java
 
 %:
 	dh $@


Bug#910093: maven-compiler-plugin: tests fail due to hardcoded junit jar path and missing JAVA_HOME

2018-10-02 Thread Tiago Stürmer Daitx
Package: maven-compiler-plugin
Version: 3.8.0-1
Severity: minor

Dear Maintainer,

Currently maven-compiler-plugin tests are failing due to 2 different
reasons:
1. Some tests depend on JAVA_HOME being set
2. The junit jar file is hardcoded to version 3.8.1

Excerpt of the buildlog with the test failures:
[ERROR] Tests run: 12, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 8.983 
s <<< FAILURE! - in org.apache.maven.plugin.compiler.CompilerMojoTestCase
[ERROR] 
testCompilerBasic(org.apache.maven.plugin.compiler.CompilerMojoTestCase)  Time 
elapsed: 5.642 s  <<< ERROR!
org.apache.maven.plugin.compiler.CompilationFailureException: Compilation 
failure
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerBasic(CompilerMojoTestCase.java:99)

[ERROR] 
testCompilerIncludesExcludes(org.apache.maven.plugin.compiler.CompilerMojoTestCase)
  Time elapsed: 0.784 s  <<< ERROR!
org.apache.maven.plugin.compiler.CompilationFailureException: Compilation 
failure
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerIncludesExcludes(CompilerMojoTestCase.java:190)

[ERROR] 
testCompileSkipMain(org.apache.maven.plugin.compiler.CompilerMojoTestCase)  
Time elapsed: 0.369 s  <<< ERROR!
org.apache.maven.plugin.compiler.CompilationFailureException: Compilation 
failure
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompileSkipMain(CompilerMojoTestCase.java:359)

[ERROR] testCompilerFork(org.apache.maven.plugin.compiler.CompilerMojoTestCase) 
 Time elapsed: 0.163 s  <<< ERROR!
org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:215)
Caused by: org.codehaus.plexus.compiler.CompilerException: Error while 
executing the external compiler.
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:215)
Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error while 
executing process.
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:215)
Caused by: java.io.IOException: Cannot run program "bin/javac" (in directory 
"/<>"): error=2, No such file or directory
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:215)
Caused by: java.io.IOException: error=2, No such file or directory
at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:215)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   CompilerMojoTestCase.testCompileSkipMain:359 ? CompilationFailure 
Compilation ...
[ERROR]   CompilerMojoTestCase.testCompilerBasic:99 ? CompilationFailure 
Compilation fai...
[ERROR]   CompilerMojoTestCase.testCompilerFork:215 ? MojoExecution Fatal error 
compilin...
[ERROR]   CompilerMojoTestCase.testCompilerIncludesExcludes:190 ? 
CompilationFailure Com...
[INFO]
[ERROR] Tests run: 12, Failures: 0, Errors: 4, Skipped: 0
[INFO]
[ERROR] There are test failures.


Expected result with passing tests:
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 51.216 
s - in org.apache.maven.plugin.compiler.CompilerMojoTestCase
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0


I will be attaching the debdiff with a fix as soon as I have a bug
number to reference to in the changelog.

Regards,
Tiago

-- System Information:
Debian Release: buster/sid
  APT prefers cosmic
  APT policy: (500, 'cosmic'), (400, 'cosmic-proposed')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-7-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled