Hello, as stated earlier in this thread. I'm not going to spend any more time on packaging java. But for others, more skilled in this mine-field, being able to continue the work, here are some notes. Even if non of this is working it at least saves some time figuring out the source-urls and checksums :-)
So here are my scratches from my work on packaging some java packages and maven. Good Luck! Notes for a "junits" ant task: outputting the reports into some "${build.home}/test-reports" seems to be a good idea. ; <target name="junit" depends="compile-test"> ; <test name="${test.entry}" todir="${build.home}/test-reports" if="test.entry"/> ; <batchtest fork="yes" todir="${build.home}/test-reports" unless="test.entry"> ; <fileset dir="${test.home}"> ; <include name="**/*Test.java"/> ; <exclude name="**/*AbstractTest.java"/> ; </fileset> ; </batchtest> ; <batchtest> ; <fileset dir="src/test" includes="**/*Test.java"/> ; </batchtest> ; <target name="compile-test" depends="compile" description="Compile tests"> ; <compile module="test" refid="path.run"/> ; </target> ; -*- mode: scheme -*- (use-modules (guix) (guix build-system ant) (guix build java-utils) (guix git-download) ((guix licenses) #:prefix license:) (gnu packages base) (gnu packages java) (gnu packages zip) ) ;---------- (define-public maven-ant-helper ; todo: check content of files " Helper scripts for building Maven components with ant This is a package from Debian. It adds some environment that should simplify generating of (originally) Debian packages. I seems to be meant to use maven and implement something like the "default build.xml" we have for ant-build-system. I doubt this is the way to go since it does thing guix typically does in guile. Additionally it is designed to be felxible which makes it more complicated again. It includes a "modello" implementation, which *may* be worth carving out - some person knowledable in java may be able to tell if it. " (package (name "maven-ant-helper") (version "7.11") (source (origin (method git-fetch) (uri (git-reference (url "git://anonscm.debian.org/pkg-java/maven-ant-helper.git") (commit (string-append "debian/" version)))) (sha256 (base32 "1aldw40b5bv0sx3nxp0m3zwdwrnyp1cslwqv4z1ifz1jkj4zm8vb")))) (build-system ant-build-system) ; todo: build javadocs (arguments `(#:jar-name (string-append ,name "-" ,version ".jar") #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-files (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (share (string-append out "/share/maven-ant-helper"))) (substitute* "maven-build.xml" ; lib${package}-java -> java-${package} (("<property name=\"bin.package\" value=\"lib\\$\\{package\\}-java\"") "<property name=\"bin.package\" value=\"java-\\$\\{package\\}\"") (("\"/usr/share/maven-ant-helper/") (string-append "\"" share "/")) )))) (add-after 'install 'install-other-files (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (share (string-append out "/share/maven-ant-helper"))) (install-file "maven-build.xml" share) (install-file "maven-defaults.properties" share) (install-file "manifest.mf" share) (copy-recursively "bootstrap" (string-append share "/bootstrap")) )))))) (home-page "https://anonscm.debian.org/cgit/pkg-java/maven-ant-helper.git") (synopsis "Helper scripts for building Maven components with ant") (description "An environment that can be used to simplify the creation of GUIX packages to support the Maven system. A \"modello\" ant task is also provided. maven-build.xml attempts to reproduce the Maven build life-cycle. You can use it to build your jar or javadoc. If you have java-maven-core installed, you can even use it to launch some Maven plugins to generate some code.") (license license:asl2.0))) (define-public maven-ant-tasks ; fails to build " I assume this is a task to run ant from a maven .pom file. I though it might be useful, but did not get any further. " (package (name "maven-ant-tasks") (version "2.1.3") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "ant-tasks/" version "/source/" "maven-ant-tasks-" version "-src.zip")) ; no tar.gz (sha256 (base32 "1d3iplx8yf19l0zyan6jgy94sdly9lylagjdwmclzw6zk848z0rv")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" ;#:jar-name (string-append "easymock-" ,version ".jar") )) (native-inputs `(("unzip" ,unzip) ("java-junit" ,java-junit))) (home-page "") (synopsis "") (description "") (license license:asl2.0))) (define-public maven-ant-plugin ; requires maven :-( (package (name "maven-ant-plugin") (version "2.4") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/plugins/" "maven-ant-plugin-" version "-source-release.zip")) (sha256 (base32 "1jac72mvmqaga7qmdj7xfpdjqb4925aw6jimb4izzy45fwd8dsff")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append ,name "-" ,version ".jar") )) (native-inputs `(;("unzip" ,unzip) ; ("java-junit" ,java-junit) )) (home-page "") (synopsis "Generates an Ant build file from a POM.") (description "") (license license:asl2.0))) (define-public maven ; fails to build " This should become the main maven package. Maven requires *a lot* of other jar-files, see list below. 'Bootstrapping' this package (as the documentation calls it) required some .jar files to exist. Some of which are included, others are downloaded from the internet. The source is organized into some sub-projects, e.g 'maven-artifacts', some of which I ewas able to build - see the package descriptions below. Using separate packages for each of these sub-projects will propably not be senceful, I just did it to figure out how far I can get. subprojects: artifact, builder-support, compat, core, embedder, model, model-builder, plugin-api repositoy-metadata, settings, settings-builder One solution could be to process each of the 'configure', 'build', 'install' steps of the ant-builder for each subproject. maven-core requires: Subprojects: maven-artifact, maven-execution, maven-model, maven-graph maven-internal maven-lifecycle maven-plugin maven-project maven-repository maven-session External: plexus-component plexus-logging eclipse-aether eclipse-aether-repository eclipse-aether-util com.google.common.collect " (package (name "maven") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) todo: remove included .jar files. Attention: some .jar-files are in the test-suite an seem to be used for checking results. (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:build-target "all" ;#:jar-name (string-append "easymock-" ,version ".jar") #:phases (modify-phases %standard-phases (add-after 'unpack 'create-build.properties ; ant -Dmaven.home="$HOME/apps/maven/apache-maven-3.3.x-SNAPSHOT" (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (setenv "M2_HOME" out))))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "") (synopsis "") (description "") (license license:asl2.0))) (define-public java-maven-subproject-artifact ; builds (package (name "java-maven-subproject-artifact") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append "maven-artifact-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'change-dir (lambda _ (chdir "maven-artifact")))) )) (native-inputs `(("java-commons-lang3" ,java-commons-lang3) ("java-plexus-util" ,java-plexus-util) ;("java-junit" ,java-junit) )) (home-page "") (synopsis "") (description "") (license license:asl2.0))) (define-public java-maven-subproject-builder-support ; builds (package (name "java-maven-subproject-builder-support") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append "maven-builder-support-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'change-dir (lambda _ (chdir "maven-builder-support")))) )) (native-inputs `(("java-commons-lang3" ,java-commons-lang3) ("java-plexus-util" ,java-plexus-util) ;("java-junit" ,java-junit) )) (home-page "") (synopsis "") (description "") (license license:asl2.0))) ; settings-builder: maven-builder-support, maven-settings, plexus-utils, plexus-interpolation, ; plexus-component-annotations, plexus-sec-dispatcher, commons-lang3 (define-public java-maven-subproject-settings ; builds (package (name "java-maven-subproject-settings") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append "maven-settings-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'change-dir (lambda _ (chdir "maven-settings")))) )) (native-inputs `(("java-commons-lang3" ,java-commons-lang3) ("java-plexus-util" ,java-plexus-util) ;("java-junit" ,java-junit) )) (home-page "") (synopsis "") (description "") (license license:asl2.0))) (define-public java-maven-subproject-repository-metadata ; builds (package (name "java-maven-subproject-repository-metadata") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append "maven-repository-metadata-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'change-dir (lambda _ (chdir "maven-repository-metadata")))) )) (native-inputs `(;("java-commons-lang3" ,java-commons-lang3) ("java-plexus-util" ,java-plexus-util) ;("java-junit" ,java-junit) )) (home-page "") (synopsis "") (description "") (license license:asl2.0))) ; model-builder: plexus-utils, plexus-interpolation, plexus-component-annotations, maven-model, ; maven-artifact, maven-builder-support, com.google.guava, commons-lang3, ; org.eclipse.sisu.plexus (define-public java-maven-subproject-model ; fails to build (package (name "java-maven-subproject-model") (version "3.3.9") (source (origin (method url-fetch) (uri (string-append "https://archive.apache.org/dist/maven/" "maven-3/" version "/source/" "apache-maven-" version "-src.tar.gz")) (sha256 (base32 "1g0iavyb34kvs3jfrx2hfnr8lr11m39sj852cy7528wva1glfl4i")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(#:jar-name (string-append "maven-model-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'change-dir (lambda _ (chdir "maven-model")))) )) (native-inputs `(("java-commons-lang3" ,java-commons-lang3) ("java-plexus-util" ,java-plexus-util) ; modello-maven-plugin for building some files ("java-junit" ,java-junit))) (home-page "") (synopsis "") (description "") (license license:asl2.0))) ;---------- (define-public java-easymock ; requires com.google.dexmaker.stock for building! (package (name "java-easymock") (version "3.4") (source (origin (method url-fetch) (uri (string-append "https://github.com/easymock/easymock/archive/" "easymock-" version ".tar.gz")) (sha256 (base32 "1yzg0kv256ndr57gpav46cyv4a1ns5sj722l50zpxk3j6sk9hnmi")))) (build-system ant-build-system) ;(outputs '("out" "doc")) (arguments `(;#:test-target "test" #:jar-name (string-append "easymock-" ,version ".jar") #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ ; the core component is in a sub-directory, tests would be in ; some `test-…` directory side. (chdir "core")))))) (inputs `(("java-junit" ,java-junit))) (home-page "") (synopsis "") (description "") (license license:asl2.0))) ;---------- (define* (apache-commons-url projname version #:optional (basename (string-append "commons-" projname))) (string-append "mirror://apache/commons/" projname "/source/" basename "-" version "-src.tar.gz")) (define-public java-commons-beanutils ; requires commons-collections, commons-logging (package (name "java-commons-beanutils") (version "1.9.2") (source (origin (method url-fetch) (uri (apache-commons-url "beanutils" version)) (sha256 (base32 "0j805kxn6a61s8wxpcj1bw4zcg9dgx3ah6nzk2nqn9sznv9wmz4i")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" ;#:jar-name (string-append "commons-beanutils-" ,version ".jar") #:phases (modify-phases %standard-phases (add-after 'unpack 'symlink-junit.jar symlink-junit-jar-hack) (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "target")) ; todo: install poms for maven (add-after 'install 'install-doc (install-javadoc "target/apidocs"))))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/beanutils/") (synopsis "") (description "") (license license:asl2.0))) (define-public java-commons-chain ; requires commons-logging, commons-digester (package (name "java-commons-chain") (version "1.2") (source (origin (method url-fetch) (uri (apache-commons-url "chain" version)) (sha256 (base32 "0lgib3dpkympp8ajlgpfavbzfal9bv685gfa9ygyv091ja772rsd")))) (build-system ant-build-system) ; todo: javadoc (arguments ; commons-chain does not provida a proper build.xml but seems to require ; maven for building `(#:jar-name (string-append "commons-chain-" ,version ".jar") #:phases (modify-phases %standard-phases ; todo: install poms for maven (delete 'check)))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/chain/") (synopsis "Chain of Responsibility pattern implemention") (description "") (license license:asl2.0))) (define-public java-commons-collections ; tests requires easymock, hamcrest (package (name "java-commons-collections") (version "4.1") (source (origin (method url-fetch) (uri (apache-commons-url "collections" version "commons-collections4")) (sha256 (base32 "1krfhvggympq4avk7gh6qafzf6b9ip6r1m4lmacikyx04039m0wl")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:tests? #f #:test-target "test" #:phases (modify-phases %standard-phases (delete 'check) ; todo: fails to load junit.framework (add-after 'unpack 'create-build.properties (lambda* (#:key inputs #:allow-other-keys) (let ((junit (assoc-ref inputs "java-junit")) (hamcrest (assoc-ref inputs "java-hamcrest")) (easymock (assoc-ref inputs "java-easymock")) (fh (open-output-file "build.properties"))) (format fh (string-append "junit.jar = " junit "/share/java/junit.jar" "\n" "hamcrest.jar = " hamcrest "/share/java/hamcrest.jar" "\n" "easymock.jar = " easymock "/share/java/easymock.jar" "\n" )) (close-output-port fh)))) (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "dist")) ; todo: install poms for maven (add-after 'install 'install-doc (install-javadoc "dist/docs/api"))))) (native-inputs `(("java-junit" ,java-junit))) ; easymock, hamcrest (home-page "http://commons.apache.org/collections/") (synopsis "") (description "") (license license:asl2.0))) (define-public java-commons-compress ;fails: requires org.mockito.InjectMocks ; lint okay. ; requires junit, orz.tukaani.xz-1.5, ; powermock-module-junit4, powermock.-api-mockito (package (name "java-commons-compress") (version "1.12") (source (origin (method url-fetch) (uri (apache-commons-url "compress" version)) (sha256 (base32 "0g36vb2a1zvy021ycy47yr1k7bb8lccc28w9n5ap5zn4dg2480rx")))) (build-system ant-build-system) ; todo: javadoc (arguments ; commons-cli does not provida a proper build.xml but seems to require ; maven for building `(#:jar-name (string-append "commons-compress-" ,version ".jar") #:phases (modify-phases %standard-phases (delete 'check)))) (inputs `(("java-xz" ,java-xz))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/compress/") (synopsis "Java API for working with compression and archive formats") (description "Apache Commons Compress defines a Java API for working with compression and archive formats. These include: bzip2, gzip, pack200, xz and ar, cpio, jar, tar, zip, dump. This is a part of the Apache Commons Project.") (license license:asl2.0))) (define-public java-commons-configuration ; requires a lot of commons modules and quite some others (package (name "java-commons-configuration") (version "2.1") (source (origin (method url-fetch) (uri (apache-commons-url "configuration" version "commons-configuration2")) (sha256 (base32 "0dk96wjmfl8dz14c2x0zazbcqam5ls6p4b182j8bqml4kzrr6l2v")))) (build-system ant-build-system) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/configuration/") (synopsis "Reading of configuration/preferences files in various formats") (description "") (license license:asl2.0))) ;; java-commons-crypto (define-public java-commons-csv ; requires junit, commons-io, commons-lang3, h2 database (package (name "java-commons-csv") (version "1.4") (source (origin (method url-fetch) (uri (apache-commons-url "csv" version)) (sha256 (base32 "1l89m0fm2s3xx3v3iynvangymfg2vlyngaj6fgsi457nmsw7m7ij")))) (build-system ant-build-system) ; todo: javadoc (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/csv/") (synopsis "") (description "") (license license:asl2.0))) (define-public java-commons-digester ; requires commons-beanutils, commons-logging (package (name "java-commons-digester") (version "3.2") (source (origin (method url-fetch) (uri (apache-commons-url "digester" version "commons-digester3")) (sha256 (base32 "03kc18dfl5ma50cn02ji7rbhm33qpxyd9js6mvzznf8f7y6pmykk")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments ; commons-cli does not provida a proper build.xml but seems to require ; maven for building `(#:jar-name (string-append ,name "-" ,version ".jar") #:src-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "dist")) (add-after 'install 'install-doc (install-javadoc "dist/docs/api"))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/digester/") (synopsis "") (description "The Apache Commons Digester package lets you configure an XML to Java object mapping module which triggers certain actions called rules whenever a particular pattern of nested XML elements is recognized.") (license license:asl2.0))) (define-public java-commons-logging ; requires javax.servlet, one of log4j, avalon, logkit (package (name "java-commons-logging") (version "1.2") (source (origin (method url-fetch) (uri (apache-commons-url "logging" version)) (sha256 (base32 "10bwcy5w8d7y39n0krlwhnp8ds3kj5zhmzj0zxnkw0qdlsjmsrj9")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:build-target "compile" #:phases (modify-phases %standard-phases (delete 'check) ; todo: make tests work (add-after 'unpack 'symlink-junit.jar symlink-junit-jar-hack) (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "target")) ; todo: install poms for maven (add-after 'install 'install-doc (install-javadoc "target/apidocs"))))) (native-inputs `(("java-junit" ,java-junit) ;javax.servlet ;optional: avalon, logkit, log4j ;("java-hamcrest-core" ,java-hamcrest-core) )) (home-page "http://commons.apache.org/logging/") (synopsis "") (description "Apache Commons Logging is a thin adapter allowing configurable bridging to other, well known logging systems") (license license:asl2.0) )) -- Schönen Gruß Hartmut Goebel Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer Information Security Management, Security Governance, Secure Software Development Goebel Consult, Landshut http://www.goebel-consult.de Blog: http://www.goebel-consult.de/blog/bestanden-iso-27001-lead-implementer Kolumne: http://www.cissp-gefluester.de/2011-10-aus-der-schublade-in-die-koepfe
smime.p7s
Description: S/MIME Cryptographic Signature