summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-07-04 21:29:23 +0200
committerJulien Lepiller <julien@lepiller.eu>2018-07-04 21:29:23 +0200
commit137bd98353645eb502e56ce0299795be6bb9b6d3 (patch)
treef28e40d521fc05d82b7a7b7bbb96741ac0bc76a6
parent892a5647debc7fe8eafac4f725c46134eb085b63 (diff)
downloadguix-137bd98353645eb502e56ce0299795be6bb9b6d3.tar.gz
gnu: maven: Fix maven crash when compiling java8 code.
* gnu/packages/maven.scm (maven)[arguments]: Configure classloading
properly instead of adding jars to maven's classpath.
-rw-r--r--gnu/packages/maven.scm42
1 files changed, 39 insertions, 3 deletions
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 447e30eb01..a3e5687dc8 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1532,12 +1532,48 @@ layer for plugins that need to keep Maven2 compatibility.")))
      `(#:phases
        (modify-phases %standard-phases
          (replace 'build
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Recreate the configuration for the loader
+             (with-output-to-file "apache-maven/src/bin/m2.conf"
+               (lambda _
+                 (format #t "main is org.apache.maven.cli.MavenCli from plexus.core~%")
+                 (format #t "~%")
+                 (format #t "set maven.conf default ${maven.home}/conf~%")
+                 (format #t "~%")
+                 (format #t "[plexus.core]~%")
+                 (format #t "load       ${maven.conf}/logging~%")
+                 (format #t "optionally ${maven.home}/lib/ext/*.jar~%")
+                 ;; Reference every jar so plexus-classworlds can find them.
+                 (for-each
+                   (lambda (dependency)
+                     (format #t "load       ~a/share/java/*.jar~%"
+                             (assoc-ref inputs dependency)))
+                   '("maven-artifact" "maven-embedder" "maven-core" "maven-compat"
+                     "maven-builder-support" "maven-model" "maven-model-builder"
+                     "maven-settings" "maven-settings-builder" "maven-plugin-api"
+                     "maven-repository-metadata" "maven-shared-utils" "maven-resolver-api"
+                     "maven-resolver-spi" "maven-resolver-util" "maven-resolver-impl"
+                     "maven-resolver-connector-basic" "maven-resolver-provider"
+                     "maven-resolver-transport-wagon" "maven-wagon-provider-api"
+                     "maven-wagon-file" "maven-wagon-http" "java-commons-logging-minimal"
+                     "java-httpcomponents-httpclient" "java-httpcomponents-httpcore"
+                     "maven-wagon-http-shared" "maven-wagon-tck-http"
+                     "java-eclipse-sisu-plexus" "java-guice" "java-aopalliance"
+                     "java-cglib" "java-asm" "java-eclipse-sisu-inject"
+                     "java-javax-inject" "java-plexus-component-annotations"
+                     "java-plexus-utils" "java-plexus-interpolation"
+                     "java-plexus-sec-dispatcher" "java-plexus-cipher" "java-guava"
+                     "java-jansi" "java-jsr250" "java-cdi-api" "java-commons-cli"
+                     "java-commons-io" "java-commons-lang3" "java-slf4j-api"
+                     "java-slf4j-simple"))))
              (substitute* "apache-maven/src/bin/mvn"
                (("cygwin=false;")
                 (string-append
-                  "CLASSPATH=" (getenv "CLASSPATH") "\n"
-                  "cygwin=false;"))
+                  "CLASSPATH="
+                  (car (find-files
+                         (assoc-ref inputs "java-plexus-classworlds")
+                         ".*.jar"))
+                  "\ncygwin=false;"))
                (("-classpath.*") "-classpath ${CLASSPATH} \\\n"))
              #t))
          (delete 'check)