diff options
author | Julien Lepiller <julien@lepiller.eu> | 2018-05-27 22:20:38 +0200 |
---|---|---|
committer | Julien Lepiller <julien@lepiller.eu> | 2018-06-09 23:24:52 +0200 |
commit | 458687d58677518a3fd3e441d2cd94d9f964990a (patch) | |
tree | 29870d1ba32df8fbfe076b146468b793adf897cf | |
parent | 816db9668c04ddfdb38fc8b4ed5836e6b743b1a0 (diff) | |
download | guix-458687d58677518a3fd3e441d2cd94d9f964990a.tar.gz |
gnu: Add maven-artifact.
* gnu/packages/maven.scm (maven-artifact): New variable. * gnu/packages/patches/maven-generate-component-xml.patch: New file. * gnu/packages/patches/maven-generate-javax-inject-named.patch: New file. * gnu/local.mk (dist_patch_DATA): Add them.
-rw-r--r-- | gnu/local.mk | 2 | ||||
-rw-r--r-- | gnu/packages/maven.scm | 38 | ||||
-rw-r--r-- | gnu/packages/patches/maven-generate-component-xml.patch | 171 | ||||
-rw-r--r-- | gnu/packages/patches/maven-generate-javax-inject-named.patch | 31 |
4 files changed, 242 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index da96bbb1a3..72339735d8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -918,6 +918,8 @@ dist_patch_DATA = \ %D%/packages/patches/mars-install.patch \ %D%/packages/patches/mars-sfml-2.3.patch \ %D%/packages/patches/maxima-defsystem-mkdir.patch \ + %D%/packages/patches/maven-generate-component-xml.patch \ + %D%/packages/patches/maven-generate-javax-inject-named.patch \ %D%/packages/patches/mcron-install.patch \ %D%/packages/patches/mcrypt-CVE-2012-4409.patch \ %D%/packages/patches/mcrypt-CVE-2012-4426.patch \ diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm index 81021f6461..c414160b34 100644 --- a/gnu/packages/maven.scm +++ b/gnu/packages/maven.scm @@ -128,3 +128,41 @@ ease usage of the repository system."))) (synopsis "Maven repository connector implementation") (description "This package contains a repository connector implementation for repositories using URI-based layouts."))) + +(define-public maven-artifact + (package + (name "maven-artifact") + (version "3.5.3") + (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 "06by23fz207lkvsndq883irfcf4p77jzkgf7n2q7hzyw1hs4h5s7")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each delete-file (find-files "." "\\.jar$")) + #t)) + (patches + (search-patches "maven-generate-component-xml.patch" + "maven-generate-javax-inject-named.patch")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "maven-artifact.jar" + #:source-dir "maven-artifact/src/main/java" + #:test-dir "maven-artifact/src/test" + #:main-class "org.apache.maven.artifact.versioning.ComparableVersion")) + (inputs + `(("java-plexus-utils" ,java-plexus-utils) + ("java-commons-lang3" ,java-commons-lang3))) + (native-inputs + `(("java-junit" ,java-junit))) + (home-page "https://maven.apache.org/") + (synopsis "Build system") + (description "Apache Maven is a software project management and comprehension +tool. This package contains the Maven Artifact classes, providing the +@code{Artifact} interface, with its @code{DefaultArtifact} implementation. The +jar file is executable and provides a little tool to display how Maven parses +and compares versions:") + (license license:asl2.0))) diff --git a/gnu/packages/patches/maven-generate-component-xml.patch b/gnu/packages/patches/maven-generate-component-xml.patch new file mode 100644 index 0000000000..6cb23c7858 --- /dev/null +++ b/gnu/packages/patches/maven-generate-component-xml.patch @@ -0,0 +1,171 @@ +From da9e282d834f0e2128501a8154128dc95b4c599d Mon Sep 17 00:00:00 2001 +From: Julien Lepiller <julien@lepiller.eu> +Date: Sat, 9 Sep 2017 20:34:38 +0200 +Subject: [PATCH] Add a script to generate component.xml files. + +plexus-component-metadata is normally used for this task, but it +depends on maven-core, which depends on maven-model-builder, which needs +plexus-component-metadata. This script is meant to break this dependency +cycle. +--- + components.sh | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 132 insertions(+) + create mode 100755 components.sh + +diff --git a/components.sh b/components.sh +new file mode 100755 +index 0000000..c6748bd +--- /dev/null ++++ b/components.sh +@@ -0,0 +1,148 @@ ++## This script generates a rough plexus/components.xml file. It is meant to ++## replace plexus-component-metadata as it eventually has a recursive dependency ++## on itself. ++## ++## This script must be run in the source directory (usually src/main/java). ++ ++# Finds the complete name from a class name. ++function find_role() { ++ role=$1 ++ # Find role ++ case $role in ++ "SettingsWriter" | "SettingsReader") ++ role=org.apache.maven.settings.io.$role ++ ;; ++ "SecDispatcher") ++ role=org.sonatype.plexus.components.sec.dispatcher.$role ++ ;; ++ "SettingsDecrypter") ++ role=org.apache.maven.settings.crypto.$role ++ ;; ++ "SettingsBuilder") ++ role=org.apache.maven.settings.building.$role ++ ;; ++ "SettingsValidator") ++ role=org.apache.maven.settings.validation.$role ++ ;; ++ "LoggerFactory") ++ role=org.eclipse.aether.spi.log.$role ++ ;; ++ "RemoteRepositoryManager" | "VersionResolver" | "VersionRangeResolver" \ ++ | "ArtifactResolver" | "RepositoryEventDispatcher" | "MetadataResolver" \ ++ | "SyncContextFactory" | "MetadataGeneratorFactory" | "MetadatResolver" \ ++ | "ArtifactDescriptorReader") ++ role=org.eclipse.aether.impl.$role ++ ;; ++ "ModelBuilder" | "ModelProcessor") ++ role=org.apache.maven.model.building.$role ++ ;; ++ "ModelValidator") ++ role=org.apache.maven.model.validation.$role ++ ;; ++ "ProfileInjector" | "ProfileSelector") ++ role=org.apache.maven.model.profile.$role ++ ;; ++ "ProfileActivator") ++ role=org.apache.maven.model.profile.activation.$role ++ ;; ++ "SuperPomProvider") ++ role=org.apache.maven.model.superpom.$role ++ ;; ++ "ReportConfigurationExpander" | "PluginConfigurationExpander" \ ++ | "ReportingConverter" | "LifecycleBindingsInjector") ++ role=org.apache.maven.model.plugin.$role ++ ;; ++ "ModelLocator") ++ role=org.apache.maven.model.locator.$role ++ ;; ++ "ModelPathTranslator" | "PathTranslator" | "UrlNormalizer" | "ModelUrlNormalizer") ++ role=org.apache.maven.model.path.$role ++ ;; ++ "DependencyManagementInjector" | "PluginManagementInjector") ++ role=org.apache.maven.model.management.$role ++ ;; ++ "ModelWriter" | "ModelReader") ++ role=org.apache.maven.model.io.$role ++ ;; ++ "DependencyManagementImporter") ++ role=org.apache.maven.model.composition.$role ++ ;; ++ "ModelNormalizer") ++ role=org.apache.maven.model.normalization.$role ++ ;; ++ "ModelInterpolator") ++ role=org.apache.maven.model.interpolation.$role ++ ;; ++ "InheritanceAssembler") ++ role=org.apache.maven.model.inheritance.$role ++ ;; ++ *) ++ role=$role ++ ;; ++ esac ++ echo $role ++} ++ ++function generate_xml() { ++echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ++echo "<component-set>" ++echo "<components>" ++ ++for file in `find -name '*.java'`; do ++ annot=`grep "@Component" $file` ++ if [ "$?" == "0" ]; then ++ # We have a component! ++ role=$(echo $annot | sed 's|.*role = \(.*\).class.*|\1|') ++ role_hint=$(echo $annot | sed 's|.*hint = "\(.*\)" .*|\1|') ++ if [ "$role_hint" = "$annot" ]; then ++ role_hint=default ++ fi ++ implem=$(echo $file | sed -e 's|^\./||' -e 's|\.java||' -e 's|/|.|g') ++ role=$(find_role $role) ++ ++ echo "<component>" ++ echo " <role>$role</role>" ++ echo " <role-hint>$role_hint</role-hint>" ++ echo " <implementation>$implem</implementation>" ++ echo " <description />" ++ echo " <isolated-realm>false</isolated-realm>" ++ echo " <requirements>" ++ reqn=1 ++ cont=true ++ while [ "$cont" = "true" ]; do ++ requirement=$(grep "@Requirement" $file -A1 | head -n ${reqn} | tail -1) ++ ((reqn++)) ++ property=$(grep "@Requirement" $file -A1 | head -n ${reqn} | tail -1) ++ if (echo $requirement | grep "@Requirement" >/dev/null); then ++ ((reqn++)) ++ ((reqn++)) ++ optional=$(echo $requirement | sed 's|.*optional = \(.*\) .*|\1|') ++ req_role=$(echo $requirement | sed 's|.*role = \(.*\).class .*|\1|') ++ if (echo $req_role | grep "@Requirement" >/dev/null); then ++ req_role=$(echo $property | sed 's|.*private \(.*\) .*|\1|') ++ fi ++ req_role=$(find_role $req_role) ++ req_name=$(echo $property | sed 's|[^ ]* [^ ]* \([^ ;]*\).*|\1|') ++ echo " <requirement>" ++ echo " <role>$req_role</role>" ++ echo " <field-name>$req_name</field-name>" ++ if (echo $optional | grep "@Requirement" >/dev/null); then ++ : ++ else ++ echo " <optional>$optional</optional>" ++ fi ++ echo " </requirement>" ++ else ++ cont=false ++ fi ++ done ++ echo " </requirements>" ++ echo "</component>" ++ fi ++done ++ ++echo "</components>" ++echo "</component-set>" ++} ++ ++(cd $1; generate_xml) > $2 +-- +2.14.1 + diff --git a/gnu/packages/patches/maven-generate-javax-inject-named.patch b/gnu/packages/patches/maven-generate-javax-inject-named.patch new file mode 100644 index 0000000000..b8eba5ab90 --- /dev/null +++ b/gnu/packages/patches/maven-generate-javax-inject-named.patch @@ -0,0 +1,31 @@ +From 1d20c0e403f1a38d4aca830e0eb4db03ba43efd3 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller <julien@lepiller.eu> +Date: Tue, 19 Sep 2017 22:21:29 +0200 +Subject: [PATCH] Add sisu-maven-plugin replacement + +--- + sisu.sh | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + create mode 100755 sisu.sh + +diff --git a/sisu.sh b/sisu.sh +new file mode 100755 +index 0000000..979f373 +--- /dev/null ++++ b/sisu.sh +@@ -0,0 +1,12 @@ ++## This script generates a rough javax.inject.Named file. It is meant to ++## replace sisu-maven-plugin as it eventually has a recursive dependency ++## on maven. ++## ++## This script must be run in the source directory (usually src/main/java). ++ ++for file in `(cd $1; find -name '*.java')`; do ++ annot=`grep "^@Named" $1/$file` ++ if [ "$annot" != "" ]; then ++ echo $file | sed -e 's|^\./||' -e 's|\.java||' -e 's|/|.|g' ++ fi ++done > $2 +-- +2.14.1 + |