You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gb...@apache.org on 2017/06/01 20:44:08 UTC

svn commit: r1797263 - in /maven/plugins/trunk/maven-shade-plugin/src: it/MSHADE-247/ it/MSHADE-247/repo/ it/MSHADE-247/repo/org/ it/MSHADE-247/repo/org/apache/ it/MSHADE-247/repo/org/apache/maven/ it/MSHADE-247/repo/org/apache/maven/its/ it/MSHADE-247...

Author: gboue
Date: Thu Jun  1 20:44:07 2017
New Revision: 1797263

URL: http://svn.apache.org/viewvc?rev=1797263&view=rev
Log:
[MSHADE-247] NullpointerException when createSourcesJar = true and source jar cannot be found
Submitted by: Anders Smestad

Applied after adding an IT.

Added:
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/pom.xml
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1-sources.jar   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.jar   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.pom
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.jar   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.pom
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/MSHADE-247/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/pom.xml?rev=1797263&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/pom.xml Thu Jun  1 20:44:07 2017
@@ -0,0 +1,78 @@
+<?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.csj</groupId>
+  <artifactId>mshade-247</artifactId>
+  <version>1.0</version>
+  <url>https://issues.apache.org/jira/browse/MSHADE-247</url>
+  <description>
+    Test that setting createSourcesJar to true does not fail the build when no sources Jar is available.
+  </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.csj</groupId>
+      <artifactId>mshade-247-one</artifactId>
+      <version>0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.its.shade.csj</groupId>
+      <artifactId>mshade-247-two</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>
+              <createSourcesJar>true</createSourcesJar>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1-sources.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1-sources.jar?rev=1797263&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1-sources.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.jar?rev=1797263&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.pom?rev=1797263&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.pom (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-one/0.1/mshade-247-one-0.1.pom Thu Jun  1 20:44:07 2017
@@ -0,0 +1,33 @@
+<?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.csj</groupId>
+  <artifactId>mshade-247-one</artifactId>
+  <version>0.1</version>
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

Added: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.jar?rev=1797263&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.pom?rev=1797263&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.pom (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/MSHADE-247/repo/org/apache/maven/its/shade/csj/mshade-247-two/0.1/mshade-247-two-0.1.pom Thu Jun  1 20:44:07 2017
@@ -0,0 +1,33 @@
+<?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.csj</groupId>
+  <artifactId>mshade-247-two</artifactId>
+  <version>0.1</version>
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

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=1797263&r1=1797262&r2=1797263&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 Thu Jun  1 20:44:07 2017
@@ -716,7 +716,7 @@ public class ShadeMojo
         coordinate.setExtension( "jar" );
         coordinate.setClassifier( "sources" );
         
-        Artifact resolvedArtifact = null;
+        Artifact resolvedArtifact;
         try
         {
             resolvedArtifact =
@@ -725,6 +725,7 @@ public class ShadeMojo
         catch ( ArtifactResolverException e )
         {
             getLog().warn( "Could not get sources for " + artifact );
+            return null;
         }
 
         if ( resolvedArtifact.isResolved() )