简体   繁体   中英

How to treat java file as resources in ant build.xml

I am willing to using ant build my java project.

I have some .java file in folder resources :

resources
   --sample1.java
   --sample2.java
   --other resources...
src
  --mycode.java

sample1.java and sample2.java are just resources like png,jpg .

Here is my problem: how can I package them into the output jar package without compile the two files?

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. But, you can try something like this..

<copy todir="your_dir"> <fileset dir="com/main/src/resources"/> </copy>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM