You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/11/21 22:51:46 UTC
svn commit: r883007 - in /maven/plugins/trunk/maven-shade-plugin/src:
it/dep-reduced-pom/ it/dep-reduced-pom/repo/ it/dep-reduced-pom/repo/org/
it/dep-reduced-pom/repo/org/apache/
it/dep-reduced-pom/repo/org/apache/maven/ it/dep-reduced-pom/repo/org/ap...
Author: bentmann
Date: Sat Nov 21 21:51:43 2009
New Revision: 883007
URL: http://svn.apache.org/viewvc?rev=883007&view=rev
Log:
[MSHADE-53] Shade createDependencyReducedPom ignores artifacts with classifier
Added:
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml (with props)
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar (with props)
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2-client.jar (with props)
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2.pom
maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy (with props)
Modified:
maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml?rev=883007&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml Sat Nov 21 21:51:43 2009
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.shade.drp</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>MSHADE-53</name>
+ <description>
+ Test that creation of the dependency reduced POM properly handles dependencies with classifiers.
+ </description>
+
+ <repositories>
+ <repository>
+ <id>shade-it</id>
+ <url>file:///${basedir}/repo</url>
+ <releases>
+ <checksumPolicy>ignore</checksumPolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.shade.drp</groupId>
+ <artifactId>a</artifactId>
+ <version>0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.its.shade.drp</groupId>
+ <artifactId>b</artifactId>
+ <version>0.2</version>
+ <classifier>client</classifier>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>attach-shade</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedArtifactAttached>false</shadedArtifactAttached>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar?rev=883007&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom?rev=883007&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom Sat Nov 21 21:51:43 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.shade.drp</groupId>
+ <artifactId>a</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <distributionManagement>
+ <repository>
+ <id>maven-core-it</id>
+ <url>file:///${basedir}/repo</url>
+ </repository>
+ </distributionManagement>
+</project>
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2-client.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2-client.jar?rev=883007&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2-client.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2.pom?rev=883007&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2.pom (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/repo/org/apache/maven/its/shade/drp/b/0.2/b-0.2.pom Sat Nov 21 21:51:43 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.shade.drp</groupId>
+ <artifactId>b</artifactId>
+ <version>0.2</version>
+ <packaging>jar</packaging>
+
+ <distributionManagement>
+ <repository>
+ <id>maven-core-it</id>
+ <url>file:///${basedir}/repo</url>
+ </repository>
+ </distributionManagement>
+</project>
Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy?rev=883007&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy Sat Nov 21 21:51:43 2009
@@ -0,0 +1,8 @@
+File pomFile = new File( basedir, "target/dependency-reduced-pom.xml" );
+assert pomFile.isFile()
+
+def ns = new groovy.xml.Namespace("http://maven.apache.org/POM/4.0.0")
+def pom = new XmlParser().parse( pomFile )
+
+assert pom[ns.modelVersion].size() == 1
+assert pom[ns.dependencies][ns.dependency].size() == 0
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/verify.groovy
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java?rev=883007&r1=883006&r2=883007&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java Sat Nov 21 21:51:43 2009
@@ -403,7 +403,7 @@
else if ( !renamed )
{
getLog().info( "Replacing original artifact with shaded artifact." );
- File originalArtifact = project.getArtifact().getFile();;
+ File originalArtifact = project.getArtifact().getFile();
replaceFile( originalArtifact, outputJar );
if ( createSourcesJar )
@@ -721,7 +721,7 @@
dependencies.add( d );
- String id = d.getGroupId() + ":" + d.getArtifactId();
+ String id = getId( d );
if ( artifactsToRemove.contains( id ) )
{
@@ -788,17 +788,26 @@
private String getId( Artifact artifact )
{
- if ( artifact.getClassifier() == null || "jar".equals( artifact.getClassifier() ) )
+ return getId( artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier() );
+ }
+
+ private String getId( Dependency dependency )
+ {
+ return getId( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier() );
+ }
+
+ private String getId( String groupId, String artifactId, String classifier )
+ {
+ if ( classifier == null || "jar".equals( classifier ) )
{
- return artifact.getGroupId() + ":" + artifact.getArtifactId();
+ return groupId + ":" + artifactId;
}
else
{
- return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getClassifier();
+ return groupId + ":" + artifactId + ":" + classifier;
}
}
-
public boolean updateExcludesInDeps( MavenProject project,
List dependencies,
List transitiveDeps )