maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1439435 - in /maven/plugins/trunk/maven-shade-plugin/src: it/dep-reduced-pom-use-base-version/ it/dep-reduced-pom-use-base-version/repo/ it/dep-reduced-pom-use-base-version/repo/org/ it/dep-reduced-pom-use-base-version/repo/org/apache/ it/...
Date Mon, 28 Jan 2013 14:57:45 GMT
Author: olamy
Date: Mon Jan 28 14:57:44 2013
New Revision: 1439435

URL: http://svn.apache.org/viewvc?rev=1439435&view=rev
Log:
[MSHADE-136] Shade dependency reduced pom uses timestamp in artifact names instead of -SNAPSHOT
Submitted by Anthony Dahanne.

Added:
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml
  (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.jar
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
  (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
  (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/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-use-base-version/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml?rev=1439435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml
(added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml
Mon Jan 28 14:57:44 2013
@@ -0,0 +1,82 @@
+<?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-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>MSHADE-136</name>
+  <description>
+    Test that creation of the dependency reduced POM properly handles snapshot dependencies
with useBaseVersion.
+  </description>
+
+  <repositories>
+    <repository>
+      <id>shade-it</id>
+      <url>file:///${basedir}/repo</url>
+      <releases>
+        <checksumPolicy>ignore</checksumPolicy>
+      </releases>
+      <snapshots>
+        <checksumPolicy>ignore</checksumPolicy>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.shade.drp</groupId>
+      <artifactId>a</artifactId>
+      <version>0.1-SNAPSHOT</version>
+      <scope>compile</scope>
+    </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>
+              <useBaseVersion>true</useBaseVersion>
+              <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
+              <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+              <dependencyReducedPomLocation>target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories?rev=1439435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories
(added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories
Mon Jan 28 14:57:44 2013
@@ -0,0 +1 @@
+a-0.1-20130115.024354-82.pom>shade-it=
\ No newline at end of file

Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.jar?rev=1439435&view=auto
==============================================================================
Files maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.jar
(added) and maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.jar
Mon Jan 28 14:57:44 2013 differ

Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom?rev=1439435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
(added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
Mon Jan 28 14:57:44 2013
@@ -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-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/a-0.1-20130115.024354-82.pom
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml?rev=1439435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
(added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
Mon Jan 28 14:57:44 2013
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+  <groupId>org.apache.maven.its.shade.drp</groupId>
+  <artifactId>a</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <versioning>
+    <snapshot>
+      <localCopy>true</localCopy>
+    </snapshot>
+    <lastUpdated>20130115024354</lastUpdated>
+    <snapshotVersions>
+      <snapshotVersion>
+        <extension>jar</extension>
+        <value>0.1-20130115.024354-82</value>
+        <updated>20130115024354</updated>
+      </snapshotVersion>
+      <snapshotVersion>
+        <extension>pom</extension>
+        <value>0.1-20130115.024354-82</value>
+        <updated>20130115024354</updated>
+      </snapshotVersion>
+    </snapshotVersions>
+  </versioning>
+</metadata>

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/verify.groovy?rev=1439435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/verify.groovy
(added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/verify.groovy
Mon Jan 28 14:57:44 2013
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+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() == 1
+// assert the dependency is named -SNAPSHOT and not -20130115.024354-82
+assert pom[ns.dependencies][ns.dependency][0][ns.version][0].text().equals("0.1-SNAPSHOT")

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom-use-base-version/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=1439435&r1=1439434&r2=1439435&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
Mon Jan 28 14:57:44 2013
@@ -365,6 +365,18 @@ public class ShadeMojo
     private String shaderHint;
 
     /**
+     * When true, the version of each dependency of the reduced pom will be based on the
baseVersion of the original
+     * dependency instead of its resolved version.
+     * For example, if the original pom (transitively) depends on a:a:2.7-SNAPSHOT, if useBaseVersion
is set to false,
+     * the reduced pom will depend on a:a:2.7-20130312.222222-12 whereas if useBaseVersion
is set to true, the reduced
+     * pom will depend on a:a:2.7-SNAPSHOT
+     *
+     * @since 3.0
+     */
+    @Parameter( defaultValue = "false" )
+    private boolean useBaseVersion;
+
+    /**
      * @since 1.6
      */
     private PlexusContainer plexusContainer;
@@ -820,7 +832,14 @@ public class ShadeMojo
             dep.setOptional( artifact.isOptional() );
             dep.setScope( artifact.getScope() );
             dep.setType( artifact.getType() );
-            dep.setVersion( artifact.getVersion() );
+            if ( useBaseVersion )
+            {
+                dep.setVersion( artifact.getBaseVersion() );
+            }
+            else
+            {
+                dep.setVersion( artifact.getVersion() );
+            }
 
             //we'll figure out the exclusions in a bit.
 



Mime
View raw message