来源和Javadoc罐子代 [英] Source and Javadoc jar generation

查看:130
本文介绍了来源和Javadoc罐子代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我的问题很简单。然而令人惊讶的是,我无法找到任何简单的解决方案。

I think my question is easy. However it is surprising that I couldn't find any easy solution.

我开发的NetBeans一个开源的Java库项目和许多人一样我想要释放它作为binary.jar,source.jar和javadoc.jar。

I'm developing an open source Java library project on Netbeans and like many others I want to release it as binary.jar, source.jar and javadoc.jar.

有没有办法在Netbeans的自动生成呢?我知道行家能做到这一点。但学习曲线似乎太长了。

Is there a way to generate them automatically on Netbeans? I know maven can do it. But the learning curve seems too long.

有一个类似的问题,但唯一的答案没有工作:<一href=\"http://stackoverflow.com/questions/855498/automatically-generating-source-and-doc-jars-in-netbeans\">Automatically在Netbeans中产生源和DOC罐子

There is a similar question but the only answer didn't work: Automatically generating source and doc jars in Netbeans

推荐答案

下面是我想出了在最后的解决方案。它使用Ant生成Javadoc和源罐子。然后它归档二进制罐子,javadoc的,source.jar,许可和自述文件中的zip文件,是准备发布。

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>

在NetBeans比右键打开build.xml - >运行目标 - > [其他目标] - > package_for_release

Open build.xml in NetBeans than right click - > run target -> [other targets] -> package_for_release

脚本获取的版本号从属性文件。我从这个解决方案<一个href=\"http://www.richardnichols.net/2009/11/automatic-release-packaging-w-version-numbers-for-netbeans-java-projects/\">here.

Script gets the version number from a properties file. I got this solution from here.

这篇关于来源和Javadoc罐子代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆