This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch MSHADE-313 in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git
commit d352a224021d43e050b8c2a1e75547e01f1489eb Author: Markus KARG <mar...@headcrashing.eu> AuthorDate: Wed Apr 3 18:58:23 2019 +0200 testing service description file syntax --- src/it/MSHADE-313/pom.xml | 49 +++------------------- src/it/MSHADE-313/service/pom.xml | 28 +++++++++++++ .../src/main/java/SomeReferencedClass.java} | 2 +- .../src/main/java/SomeServiceClass.java} | 3 +- .../src/main/java/SomeServiceInterface.java} | 2 +- .../src/main/java/SomeUnreferencedClass.java} | 2 +- .../META-INF/services/SomeServiceInterface | 20 +++++++++ src/it/MSHADE-313/{ => test}/pom.xml | 16 +------ .../MSHADE-313/{ => test}/src/main/java/Main.java | 0 src/it/MSHADE-313/verify.bsh | 8 ++-- 10 files changed, 66 insertions(+), 64 deletions(-) diff --git a/src/it/MSHADE-313/pom.xml b/src/it/MSHADE-313/pom.xml index 4772be8..0eab97c 100644 --- a/src/it/MSHADE-313/pom.xml +++ b/src/it/MSHADE-313/pom.xml @@ -23,54 +23,17 @@ under the License. <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.its.shade.mj</groupId> - <artifactId>test</artifactId> + <artifactId>aggregate</artifactId> <version>1.0</version> - <packaging>jar</packaging> + <packaging>pom</packaging> <name>MSHADE-313</name> <description> Prevent minimizeJar from excluding classes that are used by services. </description> - <dependencies> - <dependency> - <groupId>jdom</groupId> - <artifactId>jdom</artifactId> - <version>1.0</version> - </dependency> - - <dependency> - <groupId>org.glassfish.jaxb</groupId> - <artifactId>jaxb-runtime</artifactId> - <version>2.3.2</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.3.2</version> - </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> + <modules> + <module>service</module> + <module>test</module> + </modules> </project> diff --git a/src/it/MSHADE-313/service/pom.xml b/src/it/MSHADE-313/service/pom.xml new file mode 100644 index 0000000..3dc87e2 --- /dev/null +++ b/src/it/MSHADE-313/service/pom.xml @@ -0,0 +1,28 @@ +<?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>service</artifactId> + <version>1.0</version> +</project> diff --git a/src/it/MSHADE-313/src/main/java/Main.java b/src/it/MSHADE-313/service/src/main/java/SomeReferencedClass.java similarity index 96% copy from src/it/MSHADE-313/src/main/java/Main.java copy to src/it/MSHADE-313/service/src/main/java/SomeReferencedClass.java index 293e02c..afc0f5f 100644 --- a/src/it/MSHADE-313/src/main/java/Main.java +++ b/src/it/MSHADE-313/service/src/main/java/SomeReferencedClass.java @@ -17,6 +17,6 @@ * under the License. */ -public class Main +public class SomeReferencedClass { } diff --git a/src/it/MSHADE-313/src/main/java/Main.java b/src/it/MSHADE-313/service/src/main/java/SomeServiceClass.java similarity index 86% copy from src/it/MSHADE-313/src/main/java/Main.java copy to src/it/MSHADE-313/service/src/main/java/SomeServiceClass.java index 293e02c..0beac7a 100644 --- a/src/it/MSHADE-313/src/main/java/Main.java +++ b/src/it/MSHADE-313/service/src/main/java/SomeServiceClass.java @@ -17,6 +17,7 @@ * under the License. */ -public class Main +public class SomeServiceClass implements SomeServiceInterface { + private static SomeReferencedClass anEssentialDependency; } diff --git a/src/it/MSHADE-313/src/main/java/Main.java b/src/it/MSHADE-313/service/src/main/java/SomeServiceInterface.java similarity index 95% copy from src/it/MSHADE-313/src/main/java/Main.java copy to src/it/MSHADE-313/service/src/main/java/SomeServiceInterface.java index 293e02c..d5c3e95 100644 --- a/src/it/MSHADE-313/src/main/java/Main.java +++ b/src/it/MSHADE-313/service/src/main/java/SomeServiceInterface.java @@ -17,6 +17,6 @@ * under the License. */ -public class Main +public interface SomeServiceInterface { } diff --git a/src/it/MSHADE-313/src/main/java/Main.java b/src/it/MSHADE-313/service/src/main/java/SomeUnreferencedClass.java similarity index 95% copy from src/it/MSHADE-313/src/main/java/Main.java copy to src/it/MSHADE-313/service/src/main/java/SomeUnreferencedClass.java index 293e02c..7cb81ba 100644 --- a/src/it/MSHADE-313/src/main/java/Main.java +++ b/src/it/MSHADE-313/service/src/main/java/SomeUnreferencedClass.java @@ -17,6 +17,6 @@ * under the License. */ -public class Main +public class SomeUnreferencedClass { } diff --git a/src/it/MSHADE-313/service/src/main/resources/META-INF/services/SomeServiceInterface b/src/it/MSHADE-313/service/src/main/resources/META-INF/services/SomeServiceInterface new file mode 100644 index 0000000..5af3e8e --- /dev/null +++ b/src/it/MSHADE-313/service/src/main/resources/META-INF/services/SomeServiceInterface @@ -0,0 +1,20 @@ +# +# 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. +# + SomeServiceClass # Please do not remove comments or whitespace; they are part of the IT test. + diff --git a/src/it/MSHADE-313/pom.xml b/src/it/MSHADE-313/test/pom.xml similarity index 83% copy from src/it/MSHADE-313/pom.xml copy to src/it/MSHADE-313/test/pom.xml index 4772be8..b0ecdaa 100644 --- a/src/it/MSHADE-313/pom.xml +++ b/src/it/MSHADE-313/test/pom.xml @@ -25,25 +25,13 @@ under the License. <groupId>org.apache.maven.its.shade.mj</groupId> <artifactId>test</artifactId> <version>1.0</version> - <packaging>jar</packaging> - - <name>MSHADE-313</name> - <description> - Prevent minimizeJar from excluding classes that are used by services. - </description> <dependencies> <dependency> - <groupId>jdom</groupId> - <artifactId>jdom</artifactId> + <groupId>org.apache.maven.its.shade.mj</groupId> + <artifactId>service</artifactId> <version>1.0</version> </dependency> - - <dependency> - <groupId>org.glassfish.jaxb</groupId> - <artifactId>jaxb-runtime</artifactId> - <version>2.3.2</version> - </dependency> </dependencies> <build> diff --git a/src/it/MSHADE-313/src/main/java/Main.java b/src/it/MSHADE-313/test/src/main/java/Main.java similarity index 100% rename from src/it/MSHADE-313/src/main/java/Main.java rename to src/it/MSHADE-313/test/src/main/java/Main.java diff --git a/src/it/MSHADE-313/verify.bsh b/src/it/MSHADE-313/verify.bsh index 8542a85..e3c5d32 100644 --- a/src/it/MSHADE-313/verify.bsh +++ b/src/it/MSHADE-313/verify.bsh @@ -22,15 +22,17 @@ import java.util.jar.*; String[] wanted = { "Main.class", - "com/sun/xml/bind/v2/runtime/JAXBContextImpl.class" + "SomeServiceInterface.class", + "SomeServiceClass.class", + "SomeReferencedClass.class" }; String[] unwanted = { - "org/jdom/Document.class" + "SomeUnreferencedClass.class" }; -JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) ); +JarFile jarFile = new JarFile( new File( basedir, "test/target/test-1.0.jar" ) ); for ( String path : wanted ) {