[ 
https://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Rekveld updated MJAR-139:
------------------------------

    Attachment: MJAR-139.patch

I took a look at the code and found a simple way to get this fixed.

In the {{AbstractJarMojo}} class, I added a parameter called {{skipIfEmpty}} 
with a default value of false, this so not the change the behavior if the 
parameter is not set.

If this flag is set to {{true}} and the {{getClassesDirectory()}} method 
returns a directory that doesn't exist, then the archive creation will be 
skipped.
But if it is set to {{false}} (or default) then the archive will be created 
even if it is empty.
(i) This also applies to the jar goal.

Please take a look at the attached patch, no tests included.

I have deployed this patch in the 2.3.1-marvelution-1 version of the plugin 
that is available here: 
http://repository.marvelution.com/content/repositories/releases/

Cheers,
Mark

> New option to avoid empty jar creation
> --------------------------------------
>
>                 Key: MJAR-139
>                 URL: https://jira.codehaus.org/browse/MJAR-139
>             Project: Maven 2.x JAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.3.1
>            Reporter: Roman Ivanov
>         Attachments: MJAR-139.patch
>
>
> Usage of "test-jar" is beneficial for all project, as all of them have tests.
> <plugin>
>       <groupId>org.apache.maven.plugins</groupId>
>       <artifactId>maven-jar-plugin</artifactId>
>       <version>2.3.1</version>
>       <executions>
>           <execution>
>                       <goals>
>                           <goal>test-jar</goal>
>                       </goals>
>           </execution>
>       </executions>
> </plugin>
> Pom artifacts and some jar artifacts does not have test and will never have 
> them.
> In logs we have: "[WARNING] JAR will be empty - no content was marked for 
> inclusion!"
> and empty and useless artifacts are created, deployed , ...
> It will be convenient to have an plugin option to define whether skip empty 
> jar creation and warning or generate jar with warning in log. Does it make 
> sense ?
> By default option will be FALSE, to comply with previous behavior.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to