You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2012/06/27 13:37:42 UTC

svn commit: r1354435 - in /maven/plugins/trunk/maven-shade-plugin: ./ src/it/dep-reduced-pom/ src/it/mshade-123/ src/main/java/org/apache/maven/plugins/shade/mojo/

Author: bimargulies
Date: Wed Jun 27 11:37:39 2012
New Revision: 1354435

URL: http://svn.apache.org/viewvc?rev=1354435&view=rev
Log:
MSHADE-123: 1.7 Causes failures in other plugins make "basedir" point to the build dir
o revert the default back to basedir until and unless we come up with something better.

Added:
    maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/
    maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt   (with props)
Modified:
    maven/plugins/trunk/maven-shade-plugin/pom.xml
    maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java

Modified: maven/plugins/trunk/maven-shade-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/pom.xml?rev=1354435&r1=1354434&r2=1354435&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-shade-plugin/pom.xml Wed Jun 27 11:37:39 2012
@@ -30,7 +30,7 @@ under the License.
   </parent>
 
   <artifactId>maven-shade-plugin</artifactId>
-  <version>1.8-SNAPSHOT</version>
+  <version>1.7.1-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Maven Shade Plugin</name>

Modified: 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=1354435&r1=1354434&r2=1354435&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/dep-reduced-pom/pom.xml Wed Jun 27 11:37:39 2012
@@ -83,6 +83,7 @@ under the License.
 	      <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
               <shadedArtifactAttached>false</shadedArtifactAttached>
               <createDependencyReducedPom>true</createDependencyReducedPom>
+              <dependencyReducedPomLocation>target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
             </configuration>
           </execution>
         </executions>

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml?rev=1354435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml Wed Jun 27 11:37:39 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<assembly>
+    <id>zip</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+
+    <includeBaseDirectory>true</includeBaseDirectory>
+
+    <files>
+        <file>
+            <source>sample.txt</source>
+            <outputDirectory>/</outputDirectory>
+        </file>
+    </files>
+</assembly>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/assembly.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml?rev=1354435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml Wed Jun 27 11:37:39 2012
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <name>test</name>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.test</groupId>
+    <artifactId>test</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <parent>
+        <groupId>org.sonatype.oss</groupId>
+        <artifactId>oss-parent</artifactId>
+        <version>7</version>
+    </parent>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.1.2</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>@project.version@</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <minimizeJar>true</minimizeJar>
+                    <artifactSet>
+                        <includes>
+                            <include>commons-lang:commons-lang</include>
+                        </includes>
+                    </artifactSet>
+                    <relocations>
+                        <relocation>
+                            <pattern>com.apache.commons.lang</pattern>
+                            <shadedPattern>org.test.common.lang</shadedPattern>
+                        </relocation>
+                    </relocations>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.3</version>
+                <configuration>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
+                    <descriptors>
+                        <descriptor>${basedir}/assembly.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt?rev=1354435&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt Wed Jun 27 11:37:39 2012
@@ -0,0 +1 @@
+SAMPLE FILE
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mshade-123/sample.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=1354435&r1=1354434&r2=1354435&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 Wed Jun 27 11:37:39 2012
@@ -19,22 +19,6 @@ package org.apache.maven.plugins.shade.m
  * under the License.
  */
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -72,6 +56,22 @@ import org.codehaus.plexus.personality.p
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.WriterFactory;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Mojo that performs shading delegating to the Shader component.
  *
@@ -876,7 +876,8 @@ public class ShadeMojo
 
                 if ( dependencyReducedPomLocation == null )
                 {
-                    dependencyReducedPomLocation = new File ( outputDirectory, "dependency-reduced-pom.xml" );
+                    // MSHADE-123: We can't default to 'target' because it messes up uses of ${project.basedir}
+                    dependencyReducedPomLocation = new File ( project.getBasedir(), "dependency-reduced-pom.xml" );
                 }
                 
                 File f = dependencyReducedPomLocation;