相关文章推荐
New option to avoid empty jar creation
--------------------------------------

Key: MJAR-139
URL: http://jira.codehaus.org/browse/MJAR-139
Project: Maven 2.x Jar Plugin
Issue Type: Improvement
Affects Versions: 2.3.1
Reporter: Roman Ivanov


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.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ http://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=240647#action_240647 ]

Roman Ivanov commented on MJAR-139:
-----------------------------------

Please comment this idea, we would like to provide patch if you will accept and apply it.
Post by Roman Ivanov (JIRA)
New option to avoid empty jar creation
--------------------------------------
Key: MJAR-139
URL: http://jira.codehaus.org/browse/MJAR-139
Project: Maven 2.x Jar Plugin
Issue Type: Improvement
Affects Versions: 2.3.1
Reporter: Roman Ivanov
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.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ http://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241332#action_241332 ]

Vlad Skarzhevskyy commented on MJAR-139:
----------------------------------------

There are 'skip' Parameter for jar:test-jar goal. Would be nice to have the same for jar:jar goal. And not create main jar at all.
Obviously pom <packaging>test-jar</packaging> would make more sense.

My usage example is a creation of common tests modules.
The tests are executed in different poms configured with different database bindings.
Post by Roman Ivanov (JIRA)
New option to avoid empty jar creation
--------------------------------------
Key: MJAR-139
URL: http://jira.codehaus.org/browse/MJAR-139
Project: Maven 2.x Jar Plugin
Issue Type: Improvement
Affects Versions: 2.3.1
Reporter: Roman Ivanov
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.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ http://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251591#action_251591 ]

Falko Modler commented on MJAR-139:
-----------------------------------

I'd prefer the addition of the skip parameter for jar:jar.

Adding another packing might be too "invasive"...
Post by Roman Ivanov (JIRA)
New option to avoid empty jar creation
--------------------------------------
Key: MJAR-139
URL: http://jira.codehaus.org/browse/MJAR-139
Project: Maven 2.x Jar Plugin
Issue Type: Improvement
Affects Versions: 2.3.1
Reporter: Roman Ivanov
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.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ http://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251591#action_251591 ]

Falko Modler edited comment on MJAR-139 at 1/14/11 4:50 AM:
------------------------------------------------------------

I'd prefer the addition of the skip parameter for jar:jar.

Adding another packaging might be too "invasive"...

was (Author: famod):
I'd prefer the addition of the skip parameter for jar:jar.

Adding another packing might be too "invasive"...
Post by Roman Ivanov (JIRA)
New option to avoid empty jar creation
--------------------------------------
Key: MJAR-139
URL: http://jira.codehaus.org/browse/MJAR-139
Project: Maven 2.x Jar Plugin
Issue Type: Improvement
Affects Versions: 2.3.1
Reporter: Roman Ivanov
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.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ 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
Post by Roman Ivanov (JIRA)
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
[ https://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed MJAR-139.
-----------------------------------

Resolution: Fixed
Fix Version/s: 2.4
Assignee: Kristian Rosenvold

Patch applied in r1235468, thanks for the patch!

Added IT
Post by Roman Ivanov (JIRA)
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
Assignee: Kristian Rosenvold
Fix For: 2.4
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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ https://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=291849#comment-291849 ]

Roman Ivanov commented on MJAR-139:
-----------------------------------

works fine, thanks for patch

config to use:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
Post by Roman Ivanov (JIRA)
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
Assignee: Kristian Rosenvold
Fix For: 2.4
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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[ https://jira.codehaus.org/browse/MJAR-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=291978#comment-291978 ]

Mark Rekveld commented on MJAR-139:
-----------------------------------

Great,

I'll update my poms to.


Cheers, Mark
Post by Roman Ivanov (JIRA)
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
Assignee: Kristian Rosenvold
Fix For: 2.4
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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
 
推荐文章