How would I go about making a project generate javadocs with a .jar output? With maven all I need to do is add the maven-javadoc-plugin and run “mvn javadoc:jar” and it is placed in the target/ folder.
I don’t know much about Gradle so I’m unsure what exactly you’re talking about. On the command line when I run “gradle javadoc” it generates all of the documentation in .html, .js, and .css form in the directory: project_name/subproject_name/build/docs/javadoc/.
What it does not include is the .jar version of that same documentation. How do I make it so it does that? If it makes a difference, the project has subprojects that need to have their documentation generated.
…then gradle publish will get you your code, javadoc and sources jars in a repo directory as specified in the repositories{} stanza.
If you only want the javadoc, try removing the artifact sourcesJar and from components.java. I’ve never run that task without all three of them myself though. But it might work.
Thinking about the script I just posted above, I believe you can just run the javadocJar task on its own if you only want the javadoc and not the other two jars.
That will get you a jar in your project’s build/libs/ folder.
Although @ljacomet mentions „the Kotlin DSL“, it’s the same method in the Groovy DSL. I assume by him saying „DSL sugar“, that he’s also implying that it would be possible in the Groovy DSL to also do archiveClassifier = 'javadoc'.
Then you do not need to create the tasks manually and not need to add the artifacts manually to the publication which is bad practice anyway.
You also don’t need to configure mavenLocal as publishing repository, you automatically get tasks to publish to maven local without any additional configuration necessary.