andretadeu commented on a change in pull request #4: [MJAR-254] Finish the fix
of MJAR-198.
URL: https://github.com/apache/maven-jar-plugin/pull/4#discussion_r248444545
##########
File path: src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
##########
@@ -272,11 +275,25 @@ public void execute()
private boolean projectHasAlreadySetAnArtifact()
{
- final File artifact = getProject().getArtifact().getFile();
- if ( artifact != null )
+ if ( getProject().getArtifact().getFile() != null )
{
- final String defaultArtifactName = artifact.getName().replace(
".jar", "" );
- return artifact.isFile() && defaultArtifactName.equals( finalName
);
+ if ( getProject().getArtifact().getFile().isFile() )
+ {
+ try
+ {
+ JarFile existingJarFile = new JarFile(
getProject().getArtifact().getFile() );
+ Attributes existingJarFileAttr =
existingJarFile.getManifest().getMainAttributes();
Review comment:
@rfscholte Is it possible to create a finalName = <Name of the artifact
without> classifier and setting a classifier on it, just to circumvent
maven-jar-plugin and override the original JAR?
Example:
A-1.0-SNAPSHOT.jar
A-1.0-SNAPSHOT-cl1.jar -> and in pom.xml I set A-1.0-SNAPSHOT-cl1 to be
A-1.0-SNAPSHOT
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services