maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@swisspost.com>
Subject Re: Maven Jar Plugin - Testjar: includes together with skipIfEmpty
Date Tue, 29 Apr 2014 06:43:30 GMT
Hi Nick,

Nick Stolwijk wrote:

> Hi Folks,
> 
> I found a little curiosity in the maven jar plugin.
> 
> if you specify includes and the skipIfEmpty property a jar is still
> created and attached while it only has a pom file in it. I would have
> expected that the creation of the jar was skipped if no files where
> selected by my includes property.

Well, since the default includes the pom, the jar is not empty.

> My usecase: I only want to generate the tests jar when there are
> builders in the module, so other modules can use those builders in
> their tests. I don't want to package all tests, to prevent developers
> to create dependencies on these tests.
> 
> My configuration:
> 
>             <plugin>
>                 <artifactId>maven-jar-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>test-jar</goal>
>                         </goals>
>                         <configuration>
>                             <skipIfEmpty>true</skipIfEmpty>
>                             <includes>
>                                 <include>**/*Builder.class</include>
>                             </includes>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>

Configure the archiver to skip the Maven descriptor:

================== %< ==================
 <configuration>
   <archive>
     <addMavenDescriptor>false</addMavenDescriptor>
   </archive>
 </configuration>
================== %< ==================


Cheers,
Jörg


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


Mime
View raw message