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

[maven-shade-plugin] branch MSHADE-340 created (now 62efa68)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MSHADE-340
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git.


      at 62efa68  [MSHADE-340] - Shaded test jar artifact is not attached to the project

This branch includes the following new commits:

     new 62efa68  [MSHADE-340] - Shaded test jar artifact is not attached to the project

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-shade-plugin] 01/01: [MSHADE-340] - Shaded test jar artifact is not attached to the project

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MSHADE-340
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git

commit 62efa683031c73c3f2172cdee36e7a2799eb9a74
Author: Peter De Maeyer <pe...@gmail.com>
AuthorDate: Wed Dec 25 20:30:16 2019 +0100

    [MSHADE-340] - Shaded test jar artifact is not attached to the project
---
 .../api/pom.xml                                    |  32 +++++
 .../api/src/main/java/Api.java                     |  25 ++++
 .../api/src/test/java/ApiTest.java                 |  28 +++++
 .../impl/pom.xml                                   |  43 +++++++
 .../impl/src/main/java/Impl.java                   |  25 ++++
 .../impl/src/test/java/ImplTest.java               |  28 +++++
 .../pom.xml                                        | 104 ++++++++++++++++
 .../uber-user/pom.xml                              |  68 +++++++++++
 .../uber-user/src/main/java/UberUser.java          |  24 ++++
 .../uber-user/src/test/java/UberUserTest.java      |  30 +++++
 .../uber/pom.xml                                   |  74 ++++++++++++
 .../uber/src/main/java/Uber.java                   |  25 ++++
 .../uber/src/test/java/UberTest.java               |  25 ++++
 .../verify.groovy                                  | 132 +++++++++++++++++++++
 .../apache/maven/plugins/shade/mojo/ShadeMojo.java |   6 +
 15 files changed, 669 insertions(+)

diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/pom.xml b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/pom.xml
new file mode 100644
index 0000000..6b6d7e7
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/pom.xml
@@ -0,0 +1,32 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.maven.its.shade.stj</groupId>
+        <artifactId>mshade-340-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+    <artifactId>mshade-340-api</artifactId>
+</project>
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/main/java/Api.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/main/java/Api.java
new file mode 100644
index 0000000..5900a13
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/main/java/Api.java
@@ -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.
+ */
+
+/**
+ * Production API class.
+ */
+public class Api
+{
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/test/java/ApiTest.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/test/java/ApiTest.java
new file mode 100644
index 0000000..53b3902
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/api/src/test/java/ApiTest.java
@@ -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.
+ */
+
+/**
+ * Test API class.
+ */
+public class ApiTest
+{
+    public static void main(String[] args) {
+        new Api();
+    }
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/pom.xml b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/pom.xml
new file mode 100644
index 0000000..8137187
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/pom.xml
@@ -0,0 +1,43 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.maven.its.shade.stj</groupId>
+        <artifactId>mshade-340-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+    <artifactId>mshade-340-impl</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-api</artifactId>
+            <type>test-jar</type>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/main/java/Impl.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/main/java/Impl.java
new file mode 100644
index 0000000..a2e588b
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/main/java/Impl.java
@@ -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.
+ */
+
+/**
+ * Production implementation class.
+ */
+public class Impl extends Api
+{
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/test/java/ImplTest.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/test/java/ImplTest.java
new file mode 100644
index 0000000..bd2bf41
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/impl/src/test/java/ImplTest.java
@@ -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.
+ */
+
+/**
+ * Test implementation class.
+ */
+public class ImplTest extends ApiTest
+{
+    public static void main(String[] args) {
+        new Impl();
+    }
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/pom.xml b/src/it/MSHADE-340_shadedTestJarArtifactAttached/pom.xml
new file mode 100644
index 0000000..6b2fc15
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/pom.xml
@@ -0,0 +1,104 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.maven.its.shade.stj</groupId>
+    <artifactId>mshade-340-parent</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0</version>
+    <modules>
+        <module>api</module>
+        <module>impl</module>
+        <module>uber</module>
+        <module>uber-user</module>
+    </modules>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-api</artifactId>
+                <version>1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-api</artifactId>
+                <version>1.0</version>
+                <type>test-jar</type>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-impl</artifactId>
+                <version>1.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-impl</artifactId>
+                <version>1.0</version>
+                <type>test-jar</type>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-uber</artifactId>
+                <version>1.0</version>
+                <classifier>jack-of-all</classifier>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.its.shade.stj</groupId>
+                <artifactId>mshade-340-uber</artifactId>
+                <version>1.0</version>
+                <type>test-jar</type>
+                <classifier>jack-of-all-tests</classifier>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/pom.xml b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/pom.xml
new file mode 100644
index 0000000..972eb5c
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/pom.xml
@@ -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 xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.maven.its.shade.stj</groupId>
+        <artifactId>mshade-340-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+    <artifactId>mshade-340-uber-user</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-uber</artifactId>
+            <type>jar</type>
+            <classifier>jack-of-all</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-uber</artifactId>
+            <type>test-jar</type>
+            <classifier>jack-of-all-tests</classifier>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>@project.version@</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <shadedArtifactAttached>true</shadedArtifactAttached>
+                            <shadedClassifierName>jack-of-all</shadedClassifierName>
+                            <shadeTestJar>true</shadeTestJar>
+                            <createSourcesJar>true</createSourcesJar>
+                            <createTestSourcesJar>true</createTestSourcesJar>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/main/java/UberUser.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/main/java/UberUser.java
new file mode 100644
index 0000000..1697f78
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/main/java/UberUser.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class UberUser
+{
+    Api api;
+    Impl impl;
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/test/java/UberUserTest.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/test/java/UberUserTest.java
new file mode 100644
index 0000000..7c5715b
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber-user/src/test/java/UberUserTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+/**
+ * MSHADE-340 The fact that this class compiles verifies the fix.
+ * Without the fix, the (test) dependency cannot be found and compilation fails.
+ * Even though the file exists, it is not correctly attached to the project.
+ */
+public class UberUserTest
+{
+    UberUser uberUser;
+    ApiTest apiTest;
+    ImplTest implTest;
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/pom.xml b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/pom.xml
new file mode 100644
index 0000000..932efb9
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/pom.xml
@@ -0,0 +1,74 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.maven.its.shade.stj</groupId>
+        <artifactId>mshade-340-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+    <artifactId>mshade-340-uber</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-api</artifactId>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.its.shade.stj</groupId>
+            <artifactId>mshade-340-impl</artifactId>
+            <type>test-jar</type>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>@project.version@</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <shadedArtifactAttached>true</shadedArtifactAttached>
+                            <shadedClassifierName>jack-of-all</shadedClassifierName>
+                            <shadeTestJar>true</shadeTestJar>
+                            <createSourcesJar>true</createSourcesJar>
+                            <createTestSourcesJar>true</createTestSourcesJar>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/main/java/Uber.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/main/java/Uber.java
new file mode 100644
index 0000000..05fd6da
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/main/java/Uber.java
@@ -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.
+ */
+
+/**
+ * Proper class of the uber project.
+ */
+public class Uber
+{
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/test/java/UberTest.java b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/test/java/UberTest.java
new file mode 100644
index 0000000..68e2a49
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/uber/src/test/java/UberTest.java
@@ -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.
+ */
+
+/**
+ * Proper test of the uber project.
+ */
+public class UberTest
+{
+}
diff --git a/src/it/MSHADE-340_shadedTestJarArtifactAttached/verify.groovy b/src/it/MSHADE-340_shadedTestJarArtifactAttached/verify.groovy
new file mode 100644
index 0000000..e469af0
--- /dev/null
+++ b/src/it/MSHADE-340_shadedTestJarArtifactAttached/verify.groovy
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+def originalUberJar = new File( basedir, "uber/target/mshade-340-uber-1.0.jar" )
+def jackOfAllUberJar = new File( basedir, "uber/target/mshade-340-uber-1.0-jack-of-all.jar" )
+def originalUberTestJar = new File ( basedir, "uber/target/mshade-340-uber-1.0-tests.jar" )
+def jackOfAllUberTestJar = new File ( basedir, "uber/target/mshade-340-uber-1.0-jack-of-all-tests.jar" )
+def originalUberSourcesJar = new File( basedir, "uber/target/mshade-340-uber-1.0-sources.jar" )
+def jackOfAllUberSourcesJar = new File( basedir, "uber/target/mshade-340-uber-1.0-jack-of-all-sources.jar" )
+def originalUberTestSourcesJar = new File ( basedir, "uber/target/mshade-340-uber-1.0-test-sources.jar" )
+def jackOfAllUberTestSourcesJar = new File ( basedir, "uber/target/mshade-340-uber-1.0-jack-of-all-test-sources.jar" )
+
+assert originalUberJar.exists()
+assert jackOfAllUberJar.exists()
+assert originalUberTestJar.exists()
+assert jackOfAllUberTestJar.exists()
+assert originalUberSourcesJar.exists()
+assert jackOfAllUberSourcesJar.exists()
+assert originalUberTestSourcesJar.exists()
+assert jackOfAllUberTestSourcesJar.exists()
+
+def originalUberJarFile = new java.util.jar.JarFile( originalUberJar )
+try
+{
+    assert null == originalUberJarFile.getJarEntry( "Api.class" )
+    assert null == originalUberJarFile.getJarEntry( "Impl.class" )
+    assert null != originalUberJarFile.getJarEntry( "Uber.class" )
+}
+finally
+{
+    originalUberJarFile.close()
+}
+
+def jackOfAllUberJarFile = new java.util.jar.JarFile( jackOfAllUberJar )
+try
+{
+    assert null != jackOfAllUberJarFile.getJarEntry( "Api.class" )
+    assert null != jackOfAllUberJarFile.getJarEntry( "Impl.class" )
+    assert null != jackOfAllUberJarFile.getJarEntry( "Uber.class" )
+}
+finally
+{
+    jackOfAllUberJarFile.close()
+}
+
+def originalUberTestJarFile = new java.util.jar.JarFile( originalUberTestJar )
+try
+{
+    assert null == originalUberTestJarFile.getJarEntry( "ApiTest.class" )
+    assert null == originalUberTestJarFile.getJarEntry( "ImplTest.class" )
+    assert null != originalUberTestJarFile.getJarEntry( "UberTest.class" )
+}
+finally
+{
+    originalUberTestJarFile.close()
+}
+
+def jackOfAllUberTestJarFile = new java.util.jar.JarFile( jackOfAllUberTestJar )
+try
+{
+    assert null != jackOfAllUberTestJarFile.getJarEntry( "ApiTest.class" )
+    assert null != jackOfAllUberTestJarFile.getJarEntry( "ImplTest.class" )
+    assert null != jackOfAllUberTestJarFile.getJarEntry( "UberTest.class" )
+}
+finally
+{
+    jackOfAllUberTestJarFile.close()
+}
+
+def originalUberSourcesJarFile = new java.util.jar.JarFile( originalUberSourcesJar )
+try
+{
+    assert null == originalUberSourcesJarFile.getJarEntry( "Api.java" )
+    assert null == originalUberSourcesJarFile.getJarEntry( "Impl.java" )
+    assert null != originalUberSourcesJarFile.getJarEntry( "Uber.java" )
+}
+finally
+{
+    originalUberSourcesJarFile.close()
+}
+
+def jackOfAllUberSourcesJarFile = new java.util.jar.JarFile( jackOfAllUberSourcesJar )
+try
+{
+    assert null != jackOfAllUberSourcesJarFile.getJarEntry( "Api.java" )
+    assert null != jackOfAllUberSourcesJarFile.getJarEntry( "Impl.java" )
+    assert null != jackOfAllUberSourcesJarFile.getJarEntry( "Uber.java" )
+}
+finally
+{
+    jackOfAllUberSourcesJarFile.close()
+}
+
+def originalUberTestSourcesJarFile = new java.util.jar.JarFile( originalUberTestSourcesJar )
+try
+{
+    assert null == originalUberTestSourcesJarFile.getJarEntry( "ApiTest.java" )
+    assert null == originalUberTestSourcesJarFile.getJarEntry( "ImplTest.java" )
+    assert null != originalUberTestSourcesJarFile.getJarEntry( "UberTest.java" )
+}
+finally
+{
+    originalUberTestSourcesJarFile.close()
+}
+
+def jackOfAllUberTestSourcesJarFile = new java.util.jar.JarFile( jackOfAllUberTestSourcesJar )
+try
+{
+    assert null != jackOfAllUberTestSourcesJarFile.getJarEntry( "ApiTest.java" )
+    assert null != jackOfAllUberTestSourcesJarFile.getJarEntry( "ImplTest.java" )
+    assert null != jackOfAllUberTestSourcesJarFile.getJarEntry( "UberTest.java" )
+}
+finally
+{
+    jackOfAllUberTestSourcesJarFile.close()
+}
diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
index 112c301..9427923 100644
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
@@ -542,6 +542,12 @@ public class ShadeMojo
                                                       sourcesJar );
                     }
 
+                    if ( shadeTestJar )
+                    {
+                        projectHelper.attachArtifact( project, "test-jar", shadedClassifierName + "-tests",
+                                                      testJar );
+                    }
+
                     if ( createTestSourcesJar )
                     {
                         projectHelper.attachArtifact( project, "java-source",