[maven-debian-helper] 01/05: Inject plexus-utils 2.x instead of 1.1 in the dependency graph of the plugins not depending on it already (Closes: #813287)
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Feb 29 13:48:27 GMT 2016
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository maven-debian-helper.
commit a988dfea7c196a8d837474167a5fa3a5bca50372
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Mon Feb 29 12:45:32 2016 +0100
Inject plexus-utils 2.x instead of 1.1 in the dependency graph of the plugins not depending on it already (Closes: #813287)
---
debian/changelog | 8 ++
debian/copyright | 7 ++
debian/rules | 2 +-
.../maven/plugin/internal/PlexusUtilsInjector.java | 91 ++++++++++++++++++++++
4 files changed, 107 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 0e55b3b..99d08a8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+maven-debian-helper (2.0.6) UNRELEASED; urgency=medium
+
+ * Team upload.
+ * Inject plexus-utils 2.x instead of 1.1 in the dependency graph
+ of the plugins not defining a dependency on it already (Closes: #813287)
+
+ -- Emmanuel Bourg <ebourg at apache.org> Mon, 29 Feb 2016 09:13:41 +0100
+
maven-debian-helper (2.0.5) unstable; urgency=medium
* Team upload.
diff --git a/debian/copyright b/debian/copyright
index 8943d79..50ac8ae 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -13,6 +13,13 @@ Copyright: 2008-2009, Torsten Werner <twerner at debian.org>
2013-2016, Emmanuel Bourg <ebourg at apache.org>
2015, Andrew Schurman <arcticwaters at gmail.com>
License: Apache-2.0
+
+Files: maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
+Copyright: 2010-2012, The Apache Software Foundation
+License: Apache-2.0
+Comment: Copied and modified from Apache Maven
+
+License: Apache-2.0
On Debian systems, the full text of the Apache-2.0 license
can be found in the file '/usr/share/common-licenses/Apache-2.0'
diff --git a/debian/rules b/debian/rules
index 16c605c..9369194 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,7 @@ PACKAGE := $(DEB_SOURCE_PACKAGE)
VERSION := $(shell echo ${DEB_UPSTREAM_VERSION} | sed -r 's/([0-9\.]+).*/\1/')
JAVA_HOME := /usr/lib/jvm/default-java
DEB_JARS := ant-junit junit commons-io plexus-classworlds maven-core maven-artifact maven-artifact-manager maven-core-3.x maven-model \
- maven-embedder maven3-plugin-api maven-plugin-annotations maven-scm-api velocity file-management plexus-utils \
+ maven-embedder maven3-plugin-api maven-plugin-annotations maven-scm-api velocity file-management plexus-utils eclipse-aether-api eclipse-aether-util \
plexus-container-default-alpha maven-repo-helper
DEB_ANT_BUILD_TARGET := package #javadoc
DEB_ANT_BUILDFILE := debian/build.xml
diff --git a/maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java b/maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
new file mode 100644
index 0000000..8465b71
--- /dev/null
+++ b/maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
@@ -0,0 +1,91 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.DependencyGraphTransformationContext;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.graph.DefaultDependencyNode;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.util.artifact.JavaScopes;
+
+/**
+ * Injects plexus-utils:1.1 into a plugin's class path if it doesn't already declare a dependency on plexus-utils. This
+ * is another legacy bit to provide backward-compat with Maven 2.x.
+ *
+ * This class was copied from Maven and modified to use plexus-utils 2.x instead of 1.1.
+ * It overrides the same class defined by Maven since maven-debian-helper.jar is loaded first
+ * (this is ensured by the order of the load directives in /etc/maven/m2-debian.conf).
+ *
+ * @author Benjamin Bentmann
+ */
+class PlexusUtilsInjector
+ implements DependencyGraphTransformer
+{
+
+ private static final String GID = "org.codehaus.plexus";
+
+ private static final String AID = "plexus-utils";
+
+ private static final String VER = "2.x";
+
+ private static final String EXT = "jar";
+
+ public DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
+ throws RepositoryException
+ {
+ if ( findPlexusUtils( node ) == null )
+ {
+ Artifact pu = new DefaultArtifact( GID, AID, null, EXT, VER );
+ DefaultDependencyNode child = new DefaultDependencyNode( new Dependency( pu, JavaScopes.RUNTIME ) );
+ child.setRepositories( node.getRepositories() );
+ child.setRequestContext( node.getRequestContext() );
+ node.getChildren().add( child );
+ }
+
+ return node;
+ }
+
+ private DependencyNode findPlexusUtils( DependencyNode node )
+ {
+ Artifact artifact = node.getDependency().getArtifact();
+
+ if ( AID.equals( artifact.getArtifactId() ) && GID.equals( artifact.getGroupId() )
+ && EXT.equals( artifact.getExtension() ) && "".equals( artifact.getClassifier() ) )
+ {
+ return node;
+ }
+
+ for ( DependencyNode child : node.getChildren() )
+ {
+ DependencyNode result = findPlexusUtils( child );
+ if ( result != null )
+ {
+ return result;
+ }
+ }
+
+ return null;
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git
More information about the pkg-java-commits
mailing list