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_r248440762
##########
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:
If I understood the issue well, no.
> Using the same classifier with different final names should also lead to
an exception.
The test case provided was testing exactly this situation.
> So you are saying: there is actually no issue? I have always wondered why
the filename mattered... does it really matter?
I guess no. Since all the generated artifacts would have different
classifiers, when 'blank' is one possible value for the classifier, I don't
think so.
From all I got here, I'm totally open for being contested and suggestions. I
might be wrong and any number of opinions would be good for me. Someone else
should have a better grasp of this issue better than I have.
----------------------------------------------------------------
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