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.
This commit is contained in:
Julien Lepiller 2018-07-04 21:29:23 +02:00
parent 892a5647de
commit 137bd98353
No known key found for this signature in database
GPG Key ID: 43111F4520086A0C
1 changed files with 39 additions and 3 deletions

View File

@ -1532,12 +1532,48 @@ layer for plugins that need to keep Maven2 compatibility.")))
`(#:phases
(modify-phases %standard-phases
(replace 'build
(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)