maven.scm
| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
| 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; |
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU General Public License |
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (more packages maven) |
| 20 | #:use-module ((guix licenses) #:prefix license:) |
| 21 | #:use-module (gnu packages) |
| 22 | #:use-module (guix packages) |
| 23 | #:use-module (guix download) |
| 24 | #:use-module (guix utils) |
| 25 | #:use-module (guix build-system ant) |
| 26 | #:use-module (guix build-system trivial) |
| 27 | #:use-module (gnu packages bash) |
| 28 | #:use-module (gnu packages groovy) |
| 29 | #:use-module (gnu packages java) |
| 30 | #:use-module (gnu packages maven) |
| 31 | #:use-module (gnu packages web) |
| 32 | #:use-module (gnu packages version-control) |
| 33 | #:use-module (gnu packages xml) |
| 34 | #:use-module (more packages java)) |
| 35 | |
| 36 | (define-public maven-polyglot-common |
| 37 | (package |
| 38 | (name "maven-polyglot-common") |
| 39 | (version "0.3.0") |
| 40 | (source (origin |
| 41 | (method url-fetch) |
| 42 | (uri (string-append "https://github.com/takari/polyglot-maven/" |
| 43 | "archive/polyglot-" version ".tar.gz")) |
| 44 | (sha256 |
| 45 | (base32 |
| 46 | "0v8j2gj0s4vrddyk0ll38rbl69vm6rv2wnn0c8nlsz2824vhvzca")))) |
| 47 | (build-system ant-build-system) |
| 48 | (arguments |
| 49 | `(#:jar-name "maven-polyglot-common.jar" |
| 50 | #:source-dir "polyglot-common/src/main/java" |
| 51 | #:tests? #f; No test |
| 52 | #:jdk ,icedtea-8 |
| 53 | #:phases |
| 54 | (modify-phases %standard-phases |
| 55 | (add-before 'build 'copy-resources |
| 56 | (lambda _ |
| 57 | (install-file "polyglot-common/src/main/resources-filtered/maven-polyglot.properties" |
| 58 | "build/classes") |
| 59 | #t)) |
| 60 | (add-after 'build 'generate-metadata |
| 61 | (lambda _ |
| 62 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") |
| 63 | "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" |
| 64 | "--source" "polyglot-common/src/main/java" |
| 65 | "--output" "build/classes/META-INF/plexus/components.xml" |
| 66 | "--classes" "build/classes" |
| 67 | "--descriptors" "build/classes/META-INF") |
| 68 | #t)) |
| 69 | (add-after 'generate-metadata 'rebuild |
| 70 | (lambda _ |
| 71 | (invoke "ant" "jar") |
| 72 | #t))))) |
| 73 | (inputs |
| 74 | `(("java-plexus-classworlds" ,java-plexus-classworlds) |
| 75 | ("java-plexus-component-annotations" ,java-plexus-component-annotations) |
| 76 | ("java-plexus-container-default" ,java-plexus-container-default) |
| 77 | ("java-plexus-utils" ,java-plexus-utils) |
| 78 | ("maven-builder-support" ,maven-builder-support) |
| 79 | ("maven-core" ,maven-core) |
| 80 | ("maven-model" ,maven-model) |
| 81 | ("maven-model-builder" ,maven-model-builder) |
| 82 | ("maven-plugin-api" ,maven-plugin-api))) |
| 83 | (native-inputs |
| 84 | `(("java-plexus-component-metadata" ,java-plexus-component-metadata) |
| 85 | ("java-plexus-cli" ,java-plexus-cli) |
| 86 | ("java-eclipse-sisu-inject" ,java-eclipse-sisu-inject) |
| 87 | ("java-eclipse-sisu-plexus" ,java-eclipse-sisu-plexus) |
| 88 | ("java-commons-cli" ,java-commons-cli) |
| 89 | ("java-asm" ,java-asm) |
| 90 | ("java-guice" ,java-guice) |
| 91 | ("java-guava" ,java-guava) |
| 92 | ("java-cglib" ,java-cglib) |
| 93 | ("java-jdom2" ,java-jdom2) |
| 94 | ("java-qdox" ,java-qdox) |
| 95 | ("java-javax-inject" ,java-javax-inject))) |
| 96 | (home-page "https://github.com/takari/polyglot-maven") |
| 97 | (synopsis "") |
| 98 | (description "") |
| 99 | (license license:epl1.0))) |
| 100 | |
| 101 | (define-public maven-polyglot-java |
| 102 | (package |
| 103 | (inherit maven-polyglot-common) |
| 104 | (name "maven-polyglot-java") |
| 105 | (arguments |
| 106 | `(#:jar-name "maven-polyglot-java.jar" |
| 107 | #:source-dir "polyglot-java/src/main/java" |
| 108 | #:tests? #f; No test |
| 109 | #:jdk ,icedtea-8 |
| 110 | #:phases |
| 111 | (modify-phases %standard-phases |
| 112 | (add-before 'build 'copy-resources |
| 113 | (lambda _ |
| 114 | (install-file "polyglot-java/src/main/resources/META-INF/maven/extension.xml" |
| 115 | "build/classes/META-INF/maven") |
| 116 | #t)) |
| 117 | (add-after 'build 'generate-metadata |
| 118 | (lambda _ |
| 119 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") |
| 120 | "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" |
| 121 | "--source" "polyglot-java/src/main/java" |
| 122 | "--output" "build/classes/META-INF/plexus/components.xml" |
| 123 | "--classes" "build/classes" |
| 124 | "--descriptors" "build/classes/META-INF") |
| 125 | #t)) |
| 126 | (add-after 'generate-metadata 'rebuild |
| 127 | (lambda _ |
| 128 | (invoke "ant" "jar") |
| 129 | #t))))) |
| 130 | (inputs |
| 131 | `(("maven-polyglot-common" ,maven-polyglot-common) |
| 132 | ("java-commons-beanutils" ,java-commons-beanutils) |
| 133 | ("java-commons-io" ,java-commons-io) |
| 134 | ("java-guava" ,java-guava) |
| 135 | ,@(package-inputs maven-polyglot-common))))) |
| 136 | |
| 137 | (define-public maven-polyglot-groovy |
| 138 | (package |
| 139 | (inherit maven-polyglot-common) |
| 140 | (name "maven-polyglot-groovy") |
| 141 | (arguments |
| 142 | `(#:jar-name "maven-polyglot-groovy.jar" |
| 143 | #:source-dir "polyglot-groovy/src/main/java:polyglot-groovy/src/main/groovy" |
| 144 | #:tests? #f; No test |
| 145 | #:jdk ,icedtea-8 |
| 146 | #:phases |
| 147 | (modify-phases %standard-phases |
| 148 | (add-before 'build 'use-groovy |
| 149 | (lambda _ |
| 150 | (substitute* "build.xml" |
| 151 | ;; Change the compiler to groovyc |
| 152 | (("javac") "groovyc") |
| 153 | ;; Make it fork |
| 154 | (("includeantruntime=\"false\"") |
| 155 | "includeantruntime=\"false\" fork=\"yes\"") |
| 156 | ;; groovyc doesn't understand the --classpath argument (bug?) |
| 157 | (("classpath=\"@refidclasspath\"") |
| 158 | "classpathref=\"classpath\"") |
| 159 | ;; To enable joint compilation |
| 160 | (("classpathref=\"classpath\" />") |
| 161 | "classpathref=\"classpath\"><javac source=\"1.5\" target=\"1.5\" /></groovyc>") |
| 162 | ;; Actually create a definition of the groovyc task. |
| 163 | ;; FIXME: Can't we use groovy-ant for that? |
| 164 | (("<project basedir=\".\">") |
| 165 | "<project basedir=\".\"><taskdef name=\"groovyc\" |
| 166 | classname=\"org.codehaus.groovy.ant.Groovyc\" />")) |
| 167 | #t)) |
| 168 | (add-before 'build 'copy-resources |
| 169 | (lambda _ |
| 170 | (install-file "polyglot-groovy/src/main/resources/META-INF/maven/extension.xml" |
| 171 | "build/classes/META-INF/maven") |
| 172 | #t)) |
| 173 | (add-after 'build 'generate-metadata |
| 174 | (lambda _ |
| 175 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes") |
| 176 | "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" |
| 177 | "--source" "polyglot-groovy/src/main/java" |
| 178 | "--output" "build/classes/META-INF/plexus/components.xml" |
| 179 | "--classes" "build/classes" |
| 180 | "--descriptors" "build/classes/META-INF") |
| 181 | #t)) |
| 182 | (add-after 'generate-metadata 'rebuild |
| 183 | (lambda _ |
| 184 | (invoke "ant" "jar") |
| 185 | #t))))) |
| 186 | (inputs |
| 187 | `(("maven-polyglot-common" ,maven-polyglot-common) |
| 188 | ("groovy" ,groovy) |
| 189 | ("java-slf4j-api" ,java-slf4j-api) |
| 190 | ,@(package-inputs maven-polyglot-common))))) |
| 191 |