Netbeans的 - 将资源文件的JAR文件使用Ant [英] Netbeans - adding resource files to jar file with Ant

查看:129
本文介绍了Netbeans的 - 将资源文件的JAR文件使用Ant的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用NetBeans 6.9的Java项目中添加一些资源文件(非code基于文本的文件),以jar文件,我期望使用Ant。我原以为这将是相当简单的...但是相当多的搜索后,我找不到怎么办呢..!在正确的方向的任何指针?

I want add some resource files (non-code text-based files) to the jar file in a Java project using Netbeans 6.9, I'd expect using Ant. I had thought that this would be reasonably simple...but after quite a bit of searching I can't find how to do it..! Any pointers in the right direction?

推荐答案

答案我想我一直在寻找如下:

The answer I think I was looking for is as follows:

在build.xml文件(每trashgod的答案),你已经可以使用钩在Ant构建脚本添加以下内容:

In the build.xml file (as per trashgod's answer) you can use the hooks already in the ant build script to add the following:

<target name="-post-jar">
    <echo>Adding files to jar...</echo>
    <jar destfile="dist/jarFileName.jar" update="true">
        <fileset dir="${basedir}">
            <include name="files/*"/>
        </fileset>
    </jar>
</target>

这直接增加了文件,目录和任何文件根据它的jar文件。

This adds the files directory and any files under it directly to the jar file.

这篇关于Netbeans的 - 将资源文件的JAR文件使用Ant的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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