[英]How to treat java file as resources in ant build.xml
I am willing to using ant build my java project. 我愿意使用ant构建我的java项目。
I have some .java
file in folder resources
: 我在文件夹
resources
有一些.java
文件:
resources
--sample1.java
--sample2.java
--other resources...
src
--mycode.java
sample1.java
and sample2.java
are just resources like png,jpg
. sample1.java
和sample2.java
只是png,jpg
类的资源。
Here is my problem: how can I package them into the output jar package without compile the two files? 这是我的问题: 如何在不编译两个文件的情况下将它们打包到输出jar包中?
By default, when a file with java is created, it is compiled to class file(Assuming you are using some IDE.) So, packaging without compiling your java files seems to be not possible. 默认情况下,创建带有Java的文件时,它将被编译为类文件(假设您使用的是某些IDE。)因此,似乎无法打包而不编译Java文件。 But, you can try something like this..
但是,您可以尝试这样。
<copy todir="your_dir"> <fileset dir="com/main/src/resources"/> </copy>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.