如何在使用 Netbeans 的构建过程中将文件夹包含到 dist JAR 中?

发布于 2024-09-15 07:17:57 字数 623 浏览 3 评论 0原文

我正在使用 Netbeans 6.9 ,并且我已研究过编辑 build.xml 文件,以便可以将目录和文件包含在构建项目所生成的 jar 文件中。

所以我的问题是如何修改 build.xml 文件以将其他文件夹放入 jar 中?

我的项目有以下目录结构

ProjectDir/
/图片/
/src/com/...
/lib/
等等..

我希望 ant 构建脚本构建的 jar 文件看起来像

project.jar
<代码>/com
/lib --这应该包括 lib 文件夹内的 jar 文件
/images --这应该包括 jpg 文件
/META-INF

我需要这样做,因为我将 jar 文件作为自定义组件“安装”到 Adob​​e Livecycle 中,并且所有 lib jar 文件和图像都需要包含在该 jar 中。

另外,如果有一种方法可以在不使用 build.xml 文件的情况下执行此操作,那也很好,目前我只是将文件夹/文件复制到 jar 文件中。

I'm using Netbeans 6.9 , and I have looked into editing the build.xml file so that I can include directories and files in the jar file that results from building the project.

So my question is How do I modify the build.xml file to put other folders in the jar?

I have the following directory structure for my project

ProjectDir/
/images/
/src/com/...
/lib/
and so on..

And I want the jar file built by the ant build script to look like

project.jar
/com
/lib --this should include the jar files inside the lib folder
/images --this should include the jpg files
/META-INF

I need to do this because I "install" the jar file into Adobe Livecycle as a custom component and all of the lib jar files and images need to be included in the jar.

Also if there is a way to do this without using the build.xml file that would be fine also, currently I'm just copy the folders/files into the jar file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千柳 2024-09-22 07:17:57

http://ant.apache.org/manual/Tasks/copydir.html

  <copydir src="${base.path}/lib/"
           dest="${build.path}/lib"
  />

  <copydir src="${base.path}/images/"
           dest="${build.path}/images"
  />

  <copydir src="${base.path}/src/com/"
           dest="${build.path}/com"
  />
  <copydir src="${base.path}/META-INF/"
           dest="${build.path}/META-INF"
  />

http://ant.apache.org/manual/Tasks/jar.html

<jar destfile="project.jar"
     basedir="${build.path}"
     includes="**/*.*"
     />

http://ant.apache.org/manual/Tasks/copydir.html

  <copydir src="${base.path}/lib/"
           dest="${build.path}/lib"
  />

  <copydir src="${base.path}/images/"
           dest="${build.path}/images"
  />

  <copydir src="${base.path}/src/com/"
           dest="${build.path}/com"
  />
  <copydir src="${base.path}/META-INF/"
           dest="${build.path}/META-INF"
  />

http://ant.apache.org/manual/Tasks/jar.html

<jar destfile="project.jar"
     basedir="${build.path}"
     includes="**/*.*"
     />
独﹏钓一江月 2024-09-22 07:17:57

如果有人看到这个,copydir 现在已被弃用,请使用:

<target name="-post-compile">
    <copy todir="${dist.dir}/ace">
        <fileset dir="src/ace"/>
    </copy>
</target>

In case someone see this, copydir is deprecated now, use:

<target name="-post-compile">
    <copy todir="${dist.dir}/ace">
        <fileset dir="src/ace"/>
    </copy>
</target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文