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 2010/08/07 13:41:06 UTC

svn commit: r983214 - in /maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar: ./ pom.xml src/ src/main/ src/main/java/ src/main/java/Main.java verify.bsh

Author: bentmann
Date: Sat Aug  7 11:41:06 2010
New Revision: 983214

URL: http://svn.apache.org/viewvc?rev=983214&view=rev
Log:
[MSHADE-84] added support for minijar'ing

o Added IT

Added:
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh   (with props)

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml?rev=983214&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml Sat Aug  7 11:41:06 2010
@@ -0,0 +1,75 @@
+<?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.mj</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>MSHADE-84</name>
+  <description>
+    Test that artifact contents can be filtered automatically to produce a mini jar that only
+    contains the referenced classes.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>attach-shade</id>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <shadedArtifactAttached>false</shadedArtifactAttached>
+              <minimizeJar>true</minimizeJar>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java?rev=983214&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java Sat Aug  7 11:41:06 2010
@@ -0,0 +1,4 @@
+public class Main
+    extends junit.framework.TestCase
+{
+}

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh?rev=983214&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh Sat Aug  7 11:41:06 2010
@@ -0,0 +1,34 @@
+import java.io.*;
+import java.util.jar.*;
+
+String[] wanted =
+{
+    "Main.class",
+    "junit/framework/TestCase.class",
+    "junit/swingui/icons/error.gif",
+};
+
+String[] unwanted =
+{
+    "junit/swingui/TestRunner.class",
+};
+
+JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) );
+
+for ( String path : wanted )
+{
+    if ( jarFile.getEntry( path ) == null )
+    {
+        throw new IllegalStateException( "wanted path is missing: " + path );
+    }
+}
+
+for ( String path : unwanted )
+{
+    if ( jarFile.getEntry( path ) != null )
+    {
+        throw new IllegalStateException( "unwanted path is present: " + path );
+    }
+}
+
+jarFile.close();

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision