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/04/13 20:08:00 UTC

svn commit: r764546 - in /maven/plugins/trunk/maven-shade-plugin/src/site: ./ apt/ apt/examples/

Author: bentmann
Date: Mon Apr 13 18:07:59 2009
New Revision: 764546

URL: http://svn.apache.org/viewvc?rev=764546&view=rev
Log:
o Splitted examples into multiple small documents

Added:
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/attached-artifact.apt.vm
      - copied, changed from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/class-relocation.apt.vm
      - copied, changed from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/executable-jar.apt.vm
      - copied, changed from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/includes-excludes.apt.vm
      - copied, changed from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/resource-transformers.apt.vm
      - copied, changed from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
Removed:
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm
Modified:
    maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt
    maven/plugins/trunk/maven-shade-plugin/src/site/site.xml

Copied: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/attached-artifact.apt.vm (from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/attached-artifact.apt.vm?p2=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/attached-artifact.apt.vm&p1=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm&r1=763760&r2=764546&rev=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/attached-artifact.apt.vm Mon Apr 13 18:07:59 2009
@@ -1,5 +1,5 @@
  ------
- Examples
+ Attaching the Shaded Artifact
  ------
  Mauro Talevi
  ------
@@ -23,9 +23,11 @@
 ~~ specific language governing permissions and limitations
 ~~ under the License.
 
-Examples
+Attaching the Shaded Artifact
 
-* Shade Plugin with no relocation
+  By default, the plugin will replace the project's main artifact with the shaded artifact. If both the original and
+  the shaded artifact should be installed/deployed to the repository, one can configure the plugin to attach the
+  shaded artifact as a secondary artifact:
 
 +-----
 <project>
@@ -35,7 +37,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -43,203 +45,8 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with shaded relocation
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed but unattached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed and attached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
               <shadedArtifactAttached>true</shadedArtifactAttached>
               <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-              </filter>
-            </filters>
             </configuration>
           </execution>
         </executions>
@@ -250,186 +57,4 @@
 </project>
 +-----
 
-* Shade Plugin with artifact filtering using includes and excludes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-                <excludes>
-                  <exclude>org/junit/experimental/**</exclude>
-                  <exclude>org/junit/runners/**</exclude>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using excludes only
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <excludes>
-                  <exclude>junit/textui/**</include>
-                  <exclude>junit/runner/**</include>
-                  <exclude>junit/extensions/**</include>
-                  <exclude>org/junit/experimental/**</include>
-                  <exclude>org/junit/runners/**</include>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a Main-Class is added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.sonatype.haven.HavenCli</mainClass>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of manifest entries are added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <manifestEntries>
-                    <Main-Class>org.sonatype.haven.ExodusCli</Main-Class>
-                    <Build-Number>123</Build-Number>
-                  </manifestEntries>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of services entries are concatenated
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
+  The shaded artifact is distinguished from the main artifact by means of the additional classifier.

Copied: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/class-relocation.apt.vm (from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/class-relocation.apt.vm?p2=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/class-relocation.apt.vm&p1=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm&r1=763760&r2=764546&rev=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/class-relocation.apt.vm Mon Apr 13 18:07:59 2009
@@ -1,5 +1,5 @@
  ------
- Examples
+ Relocating Classes
  ------
  Mauro Talevi
  ------
@@ -23,9 +23,12 @@
 ~~ specific language governing permissions and limitations
 ~~ under the License.
 
-Examples
+Relocating Classes
 
-* Shade Plugin with no relocation
+  If the uber JAR is reused as a dependency of some other project, directly including classes from the artifact's
+  dependencies in the uber JAR can cause class loading conflicts due to duplicate classes on the class path. To
+  address this issue, one can relocate the classes which get included in the shaded artifact in order to create a
+  private copy of their bytecode:
 
 +-----
 <project>
@@ -35,7 +38,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -43,53 +46,6 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with shaded relocation
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
               <relocations>
                 <relocation>
                   <pattern>org.codehaus.plexus.util</pattern>
@@ -100,187 +56,6 @@
                   </excludes>
                 </relocation>
               </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed but unattached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed and attached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes and excludes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-                <excludes>
-                  <exclude>org/junit/experimental/**</exclude>
-                  <exclude>org/junit/runners/**</exclude>
-                </excludes>
-              </filter>
-            </filters>
             </configuration>
           </execution>
         </executions>
@@ -291,145 +66,7 @@
 </project>
 +-----
 
-* Shade Plugin with artifact filtering using excludes only
+  This instructs the plugin to move classes from the package <<<org.codehaus.plexus.util>>> and its subpackages
+  into the package <<<org.shaded.plexus.util>>> by moving the corresponding JAR file entries and rewritting the
+  affected bytecode. The class <<<Xpp3Dom>>> and some others will remain in their original package.
 
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <excludes>
-                  <exclude>junit/textui/**</include>
-                  <exclude>junit/runner/**</include>
-                  <exclude>junit/extensions/**</include>
-                  <exclude>org/junit/experimental/**</include>
-                  <exclude>org/junit/runners/**</include>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a Main-Class is added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.sonatype.haven.HavenCli</mainClass>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of manifest entries are added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <manifestEntries>
-                    <Main-Class>org.sonatype.haven.ExodusCli</Main-Class>
-                    <Build-Number>123</Build-Number>
-                  </manifestEntries>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of services entries are concatenated
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----

Copied: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/executable-jar.apt.vm (from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/executable-jar.apt.vm?p2=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/executable-jar.apt.vm&p1=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm&r1=763760&r2=764546&rev=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/executable-jar.apt.vm Mon Apr 13 18:07:59 2009
@@ -1,5 +1,5 @@
  ------
- Examples
+ Executable JAR
  ------
  Mauro Talevi
  ------
@@ -23,9 +23,9 @@
 ~~ specific language governing permissions and limitations
 ~~ under the License.
 
-Examples
+Executable JAR
 
-* Shade Plugin with no relocation
+  To create an executable uber JAR, one simply needs to set the main class that serves as the application entry point:
 
 +-----
 <project>
@@ -35,7 +35,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -43,313 +43,6 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with shaded relocation
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed but unattached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed and attached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes and excludes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-                <excludes>
-                  <exclude>org/junit/experimental/**</exclude>
-                  <exclude>org/junit/runners/**</exclude>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using excludes only
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <excludes>
-                  <exclude>junit/textui/**</include>
-                  <exclude>junit/runner/**</include>
-                  <exclude>junit/extensions/**</include>
-                  <exclude>org/junit/experimental/**</include>
-                  <exclude>org/junit/runners/**</include>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a Main-Class is added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
               <transformers>
                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                   <mainClass>org.sonatype.haven.HavenCli</mainClass>
@@ -365,7 +58,9 @@
 </project>
 +-----
 
-* Shade Plugin where a set of manifest entries are added to the MANIFEST.MF
+  This snippet configures a special resource transformer which sets the <<<Main-Class>>> entry in the <<<MANIFEST.MF>>>
+  of the shaded JAR. Other entries can be added to the <<<MANIFEST.MF>>> as well via key-value pairs in the
+  <<<\<manifestEntries\>>>> section:
 
 +-----
 <project>
@@ -375,7 +70,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -383,7 +78,6 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <finalName>haven-1.0</finalName>
               <transformers>
                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                   <manifestEntries>
@@ -401,35 +95,3 @@
   ...
 </project>
 +-----
-
-* Shade Plugin where a set of services entries are concatenated
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----

Copied: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/includes-excludes.apt.vm (from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/includes-excludes.apt.vm?p2=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/includes-excludes.apt.vm&p1=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm&r1=763760&r2=764546&rev=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/includes-excludes.apt.vm Mon Apr 13 18:07:59 2009
@@ -1,5 +1,5 @@
  ------
- Examples
+ Selecting Contents for Uber JAR
  ------
  Mauro Talevi
  ------
@@ -23,9 +23,9 @@
 ~~ specific language governing permissions and limitations
 ~~ under the License.
 
-Examples
+Selecting Contents for Uber JAR
 
-* Shade Plugin with no relocation
+  The POM snippet below shows how to control which project dependencies should be included/excluded in the uber JAR:
 
 +-----
 <project>
@@ -35,7 +35,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -51,9 +51,6 @@
                   <exclude>xml-apis:xml-apis</exclude>
                 </excludes>
               </artifactSet>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
             </configuration>
           </execution>
         </executions>
@@ -64,56 +61,10 @@
 </project>
 +-----
 
-* Shade Plugin with shaded relocation
+  Of course, <<<\<includes\>>>> can be used as well to specify a white list of artifacts. Artifacts are denoted by a
+  composite idenitifer of the form <groupId>:<artifactId>[:<classifier>].
 
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed but unattached artifact
+  For fine-grained control of which classes from the selected dependencies are included, artifact filters can be used:
 
 +-----
 <project>
@@ -123,7 +74,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -131,196 +82,19 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
+              <filters>
+                <filter>
+                  <artifact>junit:junit</artifact>
+                  <includes>
+                    <include>junit/framework/**</include>
+                    <include>org/junit/**</include>
+                  </includes>
                   <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
+                    <exclude>org/junit/experimental/**</exclude>
+                    <exclude>org/junit/runners/**</exclude>
                   </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed and attached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes and excludes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-                <excludes>
-                  <exclude>org/junit/experimental/**</exclude>
-                  <exclude>org/junit/runners/**</exclude>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using excludes only
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <excludes>
-                  <exclude>junit/textui/**</include>
-                  <exclude>junit/runner/**</include>
-                  <exclude>junit/extensions/**</include>
-                  <exclude>org/junit/experimental/**</include>
-                  <exclude>org/junit/runners/**</include>
-                </excludes>
-              </filter>
-            </filters>
+                </filter>
+              </filters>
             </configuration>
           </execution>
         </executions>
@@ -331,105 +105,5 @@
 </project>
 +-----
 
-* Shade Plugin where a Main-Class is added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.sonatype.haven.HavenCli</mainClass>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of manifest entries are added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <manifestEntries>
-                    <Main-Class>org.sonatype.haven.ExodusCli</Main-Class>
-                    <Build-Number>123</Build-Number>
-                  </manifestEntries>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of services entries are concatenated
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
+  Here, Ant-like patterns are used to specify that from the dependency <<<junit:junit>>> only certain classes/resources
+  should be included in the uber JAR.

Copied: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/resource-transformers.apt.vm (from r763760, maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/resource-transformers.apt.vm?p2=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/resource-transformers.apt.vm&p1=maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm&r1=763760&r2=764546&rev=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt.vm (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples/resource-transformers.apt.vm Mon Apr 13 18:07:59 2009
@@ -1,5 +1,5 @@
  ------
- Examples
+ Resource Transformers
  ------
  Mauro Talevi
  ------
@@ -23,48 +23,17 @@
 ~~ specific language governing permissions and limitations
 ~~ under the License.
 
-Examples
+Resource Transformers
 
-* Shade Plugin with no relocation
+  Aggregating classes/resources from several artifacts into one uber JAR is straight forward as long as there is no
+  overlap. Otherwise, some kind of logic to merge resources from several JARs is required. This is where resource
+  transformers kick in.
 
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
+* Merging Plexus Component Descriptors
 
-* Shade Plugin with shaded relocation
+  JARs for components targeting the Plexus IoC container contain a <<<META-INF/plexus/components.xml>>> entry that
+  declares the component and its requirements. If the uber JAR aggregates multiple Plexus components, a
+  <<<ComponentsXmlResourceTransformer>>> needs to be used to merge the XML descriptors:
 
 +-----
 <project>
@@ -74,7 +43,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -82,24 +51,6 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
               <transformers>
                 <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
               </transformers>
@@ -113,296 +64,11 @@
 </project>
 +-----
 
-* Shade Plugin with renamed but unattached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with renamed and attached artifact
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <shadedArtifactId>shaded-artifact</shadedArtifactId>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
-              <artifactSet>
-                <excludes>
-                  <exclude>classworlds:classworlds</exclude>
-                  <exclude>junit:junit</exclude>
-                  <exclude>jmock:jmock</exclude>
-                  <exclude>xml-apis:xml-apis</exclude>
-                </excludes>
-              </artifactSet>
-              <relocations>
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using includes and excludes
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <includes>
-                  <include>junit/framework/**</include>
-                  <include>org/junit/**</include>
-                </includes>
-                <excludes>
-                  <exclude>org/junit/experimental/**</exclude>
-                  <exclude>org/junit/runners/**</exclude>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin with artifact filtering using excludes only
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-            <filters>
-              <filter>
-                <artifact>junit:junit</artifact>
-                <excludes>
-                  <exclude>junit/textui/**</include>
-                  <exclude>junit/runner/**</include>
-                  <exclude>junit/extensions/**</include>
-                  <exclude>org/junit/experimental/**</include>
-                  <exclude>org/junit/runners/**</include>
-                </excludes>
-              </filter>
-            </filters>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a Main-Class is added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.sonatype.haven.HavenCli</mainClass>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
-
-* Shade Plugin where a set of manifest entries are added to the MANIFEST.MF
-
-+-----
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <finalName>haven-1.0</finalName>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <manifestEntries>
-                    <Main-Class>org.sonatype.haven.ExodusCli</Main-Class>
-                    <Build-Number>123</Build-Number>
-                  </manifestEntries>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----
+* Concatenating Service Entries
 
-* Shade Plugin where a set of services entries are concatenated
+  JAR files providing implementations of some interfaces often ship with a <<<META-INF/services/>>> directory that
+  maps interfaces to their implementation classes for lookup by the service locator. To merge multiple implementations
+  of the same interface into one service entry, the <<<ServicesResourceTransformer>>> can be used:
 
 +-----
 <project>
@@ -412,7 +78,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>${currentVersion}</version>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -420,7 +86,6 @@
               <goal>shade</goal>
             </goals>
             <configuration>
-              <finalName>haven-1.0</finalName>
               <transformers>
                 <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
               </transformers>

Modified: maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt?rev=764546&r1=764545&r2=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt Mon Apr 13 18:07:59 2009
@@ -57,6 +57,16 @@
 
 * Examples
 
-  To provide you with better understanding on some usages of the Shade
-  Plugin, you can take a look at the {{{examples.html}examples}} page.
+  To provide you with better understanding on some usages of the Shade Plugin, 
+  you can take a look into the following examples:
+
+  * {{{examples/includes-excludes.html}Selecting Contents for Uber JAR}}
+
+  * {{{examples/class-relocation.html}Relocating Classes}}
+
+  * {{{examples/attached-artifact.html}Attaching the Shaded Artifact}}
+
+  * {{{examples/executable-jar.html}Executable JAR}}
+
+  * {{{examples/resource-transformers.html}Resource Transformers}}
 

Modified: maven/plugins/trunk/maven-shade-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/site.xml?rev=764546&r1=764545&r2=764546&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/site.xml Mon Apr 13 18:07:59 2009
@@ -25,7 +25,13 @@
       <item name="Introduction" href="index.html"/>
       <item name="Goals" href="plugin-info.html"/>
       <item name="Usage" href="usage.html"/>
-      <item name="Examples" href="examples.html"/>
+    </menu>
+    <menu name="Examples">
+      <item name="Selecting Contents for Uber JAR" href="examples/includes-excludes.html"/>
+      <item name="Relocating Classes" href="examples/class-relocation.html"/>
+      <item name="Attaching the Shaded Artifact" href="examples/attached-artifact.html"/>
+      <item name="Executable JAR" href="examples/executable-jar.html"/>
+      <item name="Resource Transformers" href="examples/resource-transformers.html"/>
     </menu>
   </body>
 </project>