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 2011/07/02 20:50:18 UTC

svn commit: r1142261 - in /maven/plugins/trunk/maven-shade-plugin: ./ src/it/mini-jar-package-info/ src/it/mini-jar-package-info/jar-with-package-info/ src/it/mini-jar-package-info/jar-with-package-info/src/ src/it/mini-jar-package-info/jar-with-packag...

Author: bimargulies
Date: Sat Jul  2 18:50:17 2011
New Revision: 1142261

URL: http://svn.apache.org/viewvc?rev=1142261&view=rev
Log:
[MSHADE-98] minimizeJar option excludes package-info classes
Submitted by: Jared Bunting

o Base patch from Jared as attached to JIRA.
o integration test (maven-shade-plugin/src/it/mini-jar-package-info) by committer.


Added:
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/
      - copied from r1142203, maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml   (with props)
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/
      - copied from r1142203, maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar/src/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java   (with props)
Removed:
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/src/
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/Main.java
    maven/plugins/trunk/maven-shade-plugin/static-remapper.txt
Modified:
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/pom.xml
    maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/verify.bsh
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml Sat Jul  2 18:50:17 2011
@@ -0,0 +1,35 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven.its.shade.mjpi</groupId>
+    <artifactId>test-package-info</artifactId>
+    <version>1</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>dep</artifactId>
+
+  <name>jar-with-package-info</name>
+  <description>
+    Jar file with a package-info in it.
+  </description>
+</project>

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

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java Sat Jul  2 18:50:17 2011
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it.pi;
+
+public class HaveOneClass
+{
+    public static final String CONSTANT = "variable";  
+
+}

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/HaveOneClass.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java Sat Jul  2 18:50:17 2011
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it.pi;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.CLASS)
+public @interface TestPackageAnnotation
+{
+
+}

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/TestPackageAnnotation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java Sat Jul  2 18:50:17 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+/**
+ * This is some javadoc for the package org.apache.maven.it.pi.
+ * 
+ * @since 100
+ */
+@TestPackageAnnotation
+package org.apache.maven.it.pi;
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/jar-with-package-info/src/main/java/org/apache/maven/it/pi/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/pom.xml?rev=1142261&r1=1142203&r2=1142261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/pom.xml (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/pom.xml Sat Jul  2 18:50:17 2011
@@ -1,5 +1,4 @@
 <?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
@@ -18,58 +17,39 @@ KIND, either express or implied.  See th
 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>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.maven.its.shade.mjpi</groupId>
+    <artifactId>test-package-info</artifactId>
+    <version>1</version>
+    <packaging>pom</packaging>
+    <name>mini-jar-with-package-info</name>
+    <description>Test for minimizeJar keeping package-info around.</description>
+    <properties>
+        <shade-version>@project.version@</shade-version>
+    </properties>
+    <modules>
+        <module>jar-with-package-info</module>
+        <module>test</module>
+    </modules>
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>2.3.2</version>
+                    <configuration>
+                        <source>1.5</source>
+                        <target>1.5</target>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-shade-plugin</artifactId>
+                    <version>${shade-version}</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
 </project>

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml Sat Jul  2 18:50:17 2011
@@ -0,0 +1,68 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven.its.shade.mjpi</groupId>
+    <artifactId>test-package-info</artifactId>
+    <version>1</version>
+  </parent>
+
+  <artifactId>test</artifactId>
+
+  <name>test-shade-with-package-info</name>
+  <description>
+    Test that artifact contents can be filtered automatically to produce a mini jar that only
+    contains the referenced classes including package-info.java.
+  </description>
+
+  <dependencies>
+    <dependency>
+    <groupId>org.apache.maven.its.shade.mjpi</groupId>
+    <artifactId>dep</artifactId>
+    <version>1</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <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-package-info/test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java?rev=1142261&view=auto
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java (added)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java Sat Jul  2 18:50:17 2011
@@ -0,0 +1,4 @@
+package org.apache.maven.it.pi;
+public class Main extends HaveOneClass
+{
+}

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/test/src/main/java/org/apache/maven/it/pi/Main.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/verify.bsh?rev=1142261&r1=1142203&r2=1142261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/verify.bsh (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/it/mini-jar-package-info/verify.bsh Sat Jul  2 18:50:17 2011
@@ -3,17 +3,16 @@ import java.util.jar.*;
 
 String[] wanted =
 {
-    "Main.class",
-    "junit/framework/TestCase.class",
-    "junit/swingui/icons/error.gif",
+    "org/apache/maven/it/pi/Main.class",
+    "org/apache/maven/it/pi/HaveOneClass.class",
+    "org/apache/maven/it/pi/package-info.class",
 };
 
 String[] unwanted =
 {
-    "junit/swingui/TestRunner.class",
 };
 
-JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) );
+JarFile jarFile = new JarFile( new File( basedir, "test/target/test-1.jar" ) );
 
 for ( String path : wanted )
 {

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java?rev=1142261&r1=1142260&r2=1142261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java Sat Jul  2 18:50:17 2011
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
@@ -79,10 +80,36 @@ public class MinijarFilter
         }
 
         removable = cp.getClazzes();
+        removePackages(artifactUnit);
         removable.removeAll( artifactUnit.getClazzes() );
         removable.removeAll( artifactUnit.getTransitiveDependencies() );
     }
 
+    private void removePackages(ClazzpathUnit artifactUnit)
+    {
+        Set packageNames = new HashSet();
+        removePackages(artifactUnit.getClazzes(), packageNames);
+        removePackages(artifactUnit.getTransitiveDependencies(), packageNames);
+    }
+
+    private void removePackages(Set clazzes, Set packageNames)
+    {
+        Iterator it = clazzes.iterator();
+        while(it.hasNext())
+        {
+            Clazz clazz = (Clazz) it.next();
+            String name = clazz.getName();
+            while(name.contains("."))
+            {
+                name = name.substring(0, name.lastIndexOf('.'));
+                if(packageNames.add(name))
+                {
+                    removable.remove(new Clazz(name + ".package-info"));
+                }
+            }
+        }
+    }
+
     public boolean canFilter( File jar )
     {
         return true;