I think my question is easy. However it is surprising that I couldn\'t find any easy solution.
I\'m developing an open source Java library project on Netbeans and l
If you are developing a library that others might help develop then you should think about using Maven.
This way you project will be independent of your IDE and also dependencies, tests and deployment will be taken care of centrally, instead of ever contributor rolling their own.m
Here is the solution I came up with at the end. It uses Ant and generates javadoc and source jar. Then it archives binary jar, javadoc, source.jar, licence and readme file in to a zip file that is ready to release.
<target name="-pre-init">
<property file="version.properties"/>
<property name="dist.jar" value="dist/${ant.project.name}-${project.version}.jar"/>
</target>
<target description="bundle sources in a jar" name="package-sources">
<jar basedir="src" destfile="build/release/${ant.project.name}-${project.version}-sources.jar"/>
</target>
<target name="package_for_release" depends="jar,javadoc, package-sources">
<mkdir dir="build/release"/>
<copy file="${dist.jar}" todir="build/release/"/>
<copy file="licence.txt" todir="build/release/"/>
<copy file="beni_oku.txt" todir="build/release/"/>
<mkdir dir="build/release/doc"/>
<copy todir="build/release/doc">
<fileset dir="dist/javadoc" includes="**"/>
</copy>
<zip basedir="build/release/" includes="**" destfile="dist/${ant.project.name}-${project.version}.zip"/>
</target>
Open build.xml in NetBeans than right click - > run target -> [other targets] -> package_for_release
Script gets the version number from a properties file. I got this solution from here.
Maven plugins could be you answer
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
With ant you can easily generate your javadoc, compile, create jars and zip-file. It's better than do it in netbeans, because if someone want to contribute he could do it with his preferred IDE.
Try ant http://ant.apache.org/ . It's easier to learn than maven and can do your code compilation.
This is all the maven config you need to attach source and javadoc automatically to the build:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-source</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
That's not too awful, is it?