You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by TERACytE <te...@gmail.com> on 2011/12/15 19:11:56 UTC

Unable to package tests in Maven 2 shaded JAR

I am creating an executable shaded JAR using Maven 2 using the following
plugin config:

            <plugin> 
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>                             
                                <transformer
                                       
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                   
<mainClass>org.myAddress.test.MainTestClass</mainClass>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                           
<finalName>uber-${artifactId}-${version}</finalName>
                            <minimizeJar>true</minimizeJar>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

The problem is that after executing "mvn clean package", the uber-JAR does
not include anything under my test folder (./src/test/java/org/myAddress/*).

How can I configure the shade plugin to include those test files?

--
View this message in context: http://maven.40175.n5.nabble.com/Unable-to-package-tests-in-Maven-2-shaded-JAR-tp5078331p5078331.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Unable to package tests in Maven 2 shaded JAR

Posted by TERACytE <te...@gmail.com>.
The MainTestClass is a Java class that executes TestNG tests when the JAR is
launched.  So they are test files.  I can understand why they would be
included by default, but is there no way to request that they are added?

--
View this message in context: http://maven.40175.n5.nabble.com/Unable-to-package-tests-in-Maven-2-shaded-JAR-tp5078331p5078422.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Unable to package tests in Maven 2 shaded JAR

Posted by Wayne Fay <wa...@gmail.com>.
> The problem is that after executing "mvn clean package", the uber-JAR does
> not include anything under my test folder (./src/test/java/org/myAddress/*).
>
> How can I configure the shade plugin to include those test files?

This is how things are supposed to work. Test files are not included
in normal jar artifacts.

Sounds like these are not in fact test files. Move them to
src/main/resources or src/main/java and they will be included as you
would like.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org