[
https://issues.apache.org/jira/browse/MJAR-198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15064380#comment-15064380
]
Karl Heinz Marbaise commented on MJAR-198:
------------------------------------------
So after diving into the attached example i'm completely puzzled, cause the
attached example uses {{finalName}} which will change only the name for
{{target}} folder and not the filename which is used during the install/deploy
part. If you really need to have different jars you need to use a classifier
something [like
this|http://maven.apache.org/plugins/maven-jar-plugin/examples/attached-jar.html]:
{code:xml}
<project>
...
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>client</classifier>
<includes>
<include>**/service/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
{code}
So the question is: What should happen if there is no classifier given and the
plugin will be executed a second time? From my point of view it should fail the
build in such cases...
> jar:jar without classifier replaces default jar
> -----------------------------------------------
>
> Key: MJAR-198
> URL: https://issues.apache.org/jira/browse/MJAR-198
> Project: Maven JAR Plugin
> Issue Type: Bug
> Affects Versions: 2.3.1, 2.3.2, 2.4, 2.5, 2.6
> Environment: Windows 8.1 Pro
> JDK 1.8 45
> Maven 3.2.5
> Reporter: Elias Elmqvist Wulcan
> Priority: Minor
> Labels: newbie
> Attachments: 0.tar, mvn.install.debug.txt
>
>
> If I add an execution of jar:jar in a project of packaging jar and do not
> configure a classifier for the additional jar, the additional jar will be
> installed instead of the default jar.
> Omitting a classifier in the configuration for the goal jar:jar is documented
> to have the effect that the jar will not be attached and this is the behavior
> that I want. Instead, the jar is attached and replaces the default jar.
> AbstractJarMojo.java:254 checks nullness of classifier to decide whether to
> attach or not. JarMojo.java:51 declares a default value the empty string for
> classifier. Maybe the combination of these lines cause the bug.
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-jar-plugin-2.6/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java?revision=1664111&view=markup
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-jar-plugin-2.6/src/main/java/org/apache/maven/plugin/jar/JarMojo.java?revision=1664111&view=markup
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)