Ant compile 不复制资源 [英] Ant compile doesn't copy the resources

查看:30
本文介绍了Ant compile 不复制资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了自己的 build.xml,它具有:

I created my own build.xml which has:

<target name="compile">
    <mkdir dir="build"/> 
    <javac destdir="build"> 
        <src path="src"/> 
    </javac>
</target>

<target name="build" depends="compile">
    <mkdir dir="dist"/>
    <jar destfile="dist/app.jar" basedir="build" />
</target>

<target name="run" depends="compile">
    <java classname="webserver.Loader" classpath="build" fork="true" />      
</target>

效果很好.当我调用 ant run 时,它会编译并运行我的应用程序,但我的应用程序有一个带有图标的包,并且它没有移动到build"文件夹中,因此我的应用程序以无法找到我的图标的异常结束.当我自己移动它们时,它就起作用了.

It works great. When I call ant run so it compiles and runs my application, but my application has a package with icons and it isn't moved to a folder "build" so my application ends with an exception that it couldn't locate my icons. When I move them by myself then it works.

我尝试使用

<copy todir="build/app/icons">
    <fileset dir="src/app/icons"/>
</copy>

它有效,但我想在没有复制命令的情况下做到这一点.javac 有参数吗?还是别的什么?

It works, but I would like to do it without the copy command. Is there any parameter to javac? Or something else?

感谢您的回答.

推荐答案

抱歉,您需要手动复制非 java 文件.资源在技术上不是来源".命令行 javac 不会将资源文件从您的源目录复制到输出目录,ant 的 javac 任务也不会.

Sorry, you will need to copy non-java files manually. Resources are technically not "source". The command-line javac will not copy resource files from your source directory to the output directory, neither will ant's javac task.

这篇关于Ant compile 不复制资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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