Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groovydoc-jar has wrong extension when installed/deployed #151

Closed
jonenst opened this issue Feb 26, 2020 · 6 comments · Fixed by #164
Closed

groovydoc-jar has wrong extension when installed/deployed #151

jonenst opened this issue Feb 26, 2020 · 6 comments · Fixed by #164
Assignees
Milestone

Comments

@jonenst
Copy link

jonenst commented Feb 26, 2020

Hi,
the groovydoc-jar is installed in the .m2 or deployed to remote repositories with an extension of "groovydoc":

 [INFO] Installing /tmp/aze/my-app/target/my-app-1.0-SNAPSHOT-groovydoc.jar to .m2/repository/my-app-1.0-SNAPSHOT-groovydoc.groovydoc

That's because it uses the type "groovydoc"
GroovyDocJarMojo.java:

projectHelper.attachArtifact(project, "groovydoc", classifier, outputFile); 

and you don't provided an artifacthandler for this type.

`See https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html where javadoc type is correctly mapped to the ".jar" extension (in https://github.com/apache/maven/blob/master/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml). If you wanted to to the same, you would have to add a component.xml and the plugin should be used with the "extension=true" parameter (as per this stackoverflow answer: https://stackoverflow.com/a/1427749 )

An alternative could be to simply use the "javadoc" type. That's what the scaladoc-maven-plugin does. https://github.com/davidB/scala-maven-plugin/blob/da1784d364236ac1b55e68649539aee9197afc93/src/main/java/scala_maven/ScalaDocJarMojo.java#L138

Note that you could also set the classifier to javadoc by default, I think it would help most projects.. Again that's what scaladoc-maven-plugin does: https://github.com/davidB/scala-maven-plugin/blob/da1784d364236ac1b55e68649539aee9197afc93/src/main/java/scala_maven/ScalaDocJarMojo.java#L70

Cheers,
Jon

@keeganwitt
Copy link
Member

keeganwitt commented Feb 27, 2020

My only concern with changing to javadoc classifier is if a project that had both Java and Groovy in it decided to produce both a javadoc and a groovydoc artifacts. I'll do some reading on the artifact handler, thank you for those links.

In the meantime, you can change the classifier with

<classifier>javadoc</classifier>

@jonenst
Copy link
Author

jonenst commented Feb 27, 2020

Hi,
Thanks for your answers. I am indeed using classifier=javadoc, I was only suggesting this to simplify the plugin in general.

@keeganwitt
Copy link
Member

keeganwitt commented Feb 28, 2020

I'm having trouble adding the artifact handler without also adding a custom package type and lifecycle (which is the only way I'd used the artifact handler in the past -- I'm not sure it's possible otherwise). I'm thinking now of making it "javadoc" type, so the default handler can parse it, but still keep "groovydoc" classifier.

Can you think of any downsides to this approach?

@jonenst
Copy link
Author

jonenst commented May 4, 2020

Hi, this is a good approach. Keeping the groovydoc classifier has the benefit of beeing backwards compatible, even if it might not be the best default for most project. I think you can merge this

@keeganwitt
Copy link
Member

I apologize for the delay, I forgot to open a PR and lost track of this.

@keeganwitt keeganwitt self-assigned this Aug 3, 2020
@keeganwitt keeganwitt added this to the 1.10.0 milestone Aug 3, 2020
@jonenst
Copy link
Author

jonenst commented Aug 5, 2020

No problem, thanks for fixing this ! Also I think it's a good thing that in the end you chose the type "javadoc".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants