Reputation: 39753
In eclipse I'd like to configure a path as a resource path. This path contains some java files that I only want to handle as resources, i.e. I don't want eclipse to try to compile these files. I only want to read them as resources from within junit tests.
Is there a way to configure eclipse so it won't try to compile the java files it found there?
Upvotes: 4
Views: 1905
Reputation: 31795
You can specify excludes for *.java files in project properties / Build Path / Sources preferences. However in that case *.java won't be copied into the target folder, so those resources won't be available at runtime classpath. To get around that, after adding excludes you can add a custom builder (e.g. Ant script) that would copy *.java files over.
Alternatively, you can use m2eclipse with Maven-enabled project and place your java files into src/main/resources, so all files from that folder won't be compiled, but they will be copied into the result classpath.
Also, you can try to point target folder to the same dir as source folder.
Upvotes: 1
Reputation: 22200
Check Included=All and Excluded=**/*.java for the specific source folder in the Java Build Path through the Project properties.
alt text http://img708.imageshack.us/img708/3509/eclipseexclusion.png
Upvotes: 0
Reputation: 945
You can remove the folder from build-path:
Eclipse won't compile Java files in that folder
Upvotes: 0