Community
Participate
Working Groups
Provide a way to state that only .java files should be processed into the output folder of a java project. For example if I have a java project in which I have the root of the project as a source folder ("project/") and my output folder is ("project/bin"), only class files should be placed into bin. Otherwise all other resources are copied into bin, and there needs to be a way to exclude all other resources. An inclusion filter of ".class" on my ouput folder would only allow .class files to be placed in bin.
Can't you simply exclude these resources from copy behavior ? see: Preferences>Java>Compiler>Build Path>Filtered Resource alternatively, you could put your resources inside a separate library folder, which you could add on your build path, only source folder contents gets into the output folder. Ok to close?
I cannot use the filter resources in build path, because the list of resources that I don't want in the output folder is infinate. The only resources I want in the output folder are compiled java source. I cannot use library, because I need the root of the project to be the place where I drop in resources. This is why I still thing we need this option. If not exclusion filters, how about a single prefrence that states only include compiled resources in the output folder?
Did you try to exclude '*.*' ? We do not consider Java/Class files as resources, this should do the trick.
I set * and *.* as exclustion filters and it works only when I drop in resources into the project. However if I use the Create new Class File Wizard to create a new class, and type in the name field, I always get the warning at the top "Folder is not on the Java build class path". If I hit finish, the wizard fails and a dialog box states: Creation of element failed. Reason: Blah.java [in <default> [in <project root> [in test]]] does not exist. Is this a bug? So to summerize using *.*, * as exclusion filters works since dropping in java source still puts the class file into bin, however creation of a Java Class using the wizard fails.
Did you exclude from the build path setting (using the source folder property) ? Or rather using Preferences>Java>Compiler>Build Path>Filtered Resource ?
I did not use Preferences>Java>Compiler>Build Path>Filtered Resource becuase I only want to apply this case to a single java project. So I used the exclusion filter on the build properties on the java project.
You can customize Java compiler preferences on a per project basis, under project properties. This is the only way to get the behavior you want. A classpath exclusion rule isn't going to help you, as it would exclude source files as well. We will add inclusion rules instead of exclusion ones for the source folders, then you may simply want to use it so as to only include *.java files. For now, the other preference is your only hope. Ok to close?
Ok I see what you are saying, before we close, is there a way to set Filtered Resources in the Build Path tab programatically?
Thanks for your help, we got in working programatically. Ok to close.
Glad you found it (using IJavaProject#setOption(...)) I presume.