Java – automatically generate source code and document jars in NetBeans

Is there any way to automatically generate source code and Javadoc jars in NetBeans? Ideally, I want to put my source and Javadoc jars in the dist folder at each build

Solution

This is my personal addition to my ant file (build. XML):

<target description="bundle sources in a jar" name="package-sources">
  <jar basedir="src" destfile="dist/${ant.project.name}-sources.jar"/>
</target>
<target depends="-javadoc-build" description="bundle javadoc in a jar" name="package-doc">
  <jar basedir="dist/javadoc" destfile="dist/${ant.project.name}-javadoc.jar"/>
</target>

Call these targets manually using NetBeans, or you can use hook targets:

<target name="-post-jar" depends="package-sources,package-doc" />
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>