You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2019/05/25 17:34:07 UTC

[maven-shade-plugin] branch MSHADE-321 created (now 276f80f)

This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a change to branch MSHADE-321
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git.


      at 276f80f  MSHADE-321 Always respect 'createDependencyReducedPom' flag

This branch includes the following new commits:

     new 276f80f  MSHADE-321 Always respect 'createDependencyReducedPom' flag

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-shade-plugin] 01/01: MSHADE-321 Always respect 'createDependencyReducedPom' flag

Posted by eo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch MSHADE-321
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git

commit 276f80f7ebb13f872bb2e34fdbd012cf25e975e9
Author: head-thrash <il...@gmail.com>
AuthorDate: Sat May 25 00:46:07 2019 +0300

    MSHADE-321
    Always respect 'createDependencyReducedPom' flag
---
 src/it/MSHADE-321_respectDrpFlag/pom.xml           |  84 +++++++++++++++++++++
 .../org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar | Bin 0 -> 1945 bytes
 .../org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom |  36 +++++++++
 src/it/MSHADE-321_respectDrpFlag/verify.groovy     |  30 ++++++++
 .../apache/maven/plugins/shade/mojo/ShadeMojo.java |  10 +--
 5 files changed, 155 insertions(+), 5 deletions(-)

diff --git a/src/it/MSHADE-321_respectDrpFlag/pom.xml b/src/it/MSHADE-321_respectDrpFlag/pom.xml
new file mode 100644
index 0000000..b78cf34
--- /dev/null
+++ b/src/it/MSHADE-321_respectDrpFlag/pom.xml
@@ -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-321</name>
+  <description>
+    Test that dependency-reduced-pom is created with respect to flag only.
+
+    Shade plugin starts to create DRP even if the artifact has been renamed because of the configuration
+  </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>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>shade</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+              <finalName>shade_321</finalName>
+              <shadedArtifactAttached>false</shadedArtifactAttached>
+              <createDependencyReducedPom>true</createDependencyReducedPom>
+              <dependencyReducedPomLocation>target/shade_321.xml</dependencyReducedPomLocation>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar b/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar
new file mode 100644
index 0000000..9794e0e
Binary files /dev/null and b/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.jar differ
diff --git a/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom b/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom
new file mode 100644
index 0000000..a80642e
--- /dev/null
+++ b/src/it/MSHADE-321_respectDrpFlag/repo/org/apache/maven/its/shade/drp/a/0.1/a-0.1.pom
@@ -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>
diff --git a/src/it/MSHADE-321_respectDrpFlag/verify.groovy b/src/it/MSHADE-321_respectDrpFlag/verify.groovy
new file mode 100644
index 0000000..5a6c4cb
--- /dev/null
+++ b/src/it/MSHADE-321_respectDrpFlag/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * 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 jarRenamedFile = new File(basedir, "target/shade_321.jar")
+assert jarRenamedFile.isFile()
+
+File pomFile = new File(basedir, "target/shade_321.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
diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
index 30d1b6e..971fad2 100644
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
@@ -532,13 +532,13 @@ public class ShadeMojo
 
                             projectHelper.attachArtifact( project, "jar", "tests", shadedTests );
                         }
-
-                        if ( createDependencyReducedPom )
-                        {
-                            createDependencyReducedPom( artifactIds );
-                        }
                     }
                 }
+
+                if ( createDependencyReducedPom )
+                {
+                    createDependencyReducedPom( artifactIds );
+                }
             }
         }
         catch ( Exception e )