Community
Participate
Working Groups
Build Identifier: 20110916-0149 This problem occurs with An EJB / WAR project with many sources directories. If in the deployment assembly descriptor some of the directories have been removed, this configuration is not taken in account when exporting the project into an EJB / WAR file. Reproducible: Always Steps to Reproduce: 1. Run Eclipse, open new workspace 2. Create new EJB project: File, New, EJB Project. Name it 'MyEJB' 3. It creates a project with a 'ejbModule' source directory. 4. In this directory create a class named 'mypackage.MyClass' 5. Create new source directory named 'test' 6. In this new directory, create a class named 'mypackage.MyTest' 7. In the project's properties, in Deployement Assembly, remove the /test/ directory. Apply. 8. Select the projet and do File, Export, EJB file, and save the jar file. 9. Open the jar file and check the mypackage directory. It contains both MyClass.class and MyTest.class while only MyClass.class should - I think - be included…
I can reproduce the same behavior with a Dynamic Web project. It looks like a common problem for all types of Java EE projects. Moving to Java EE Tools.
When you export a Java EE module (EJB, web, etc), org.eclipse.jst.common.internal.modulecore.AddMappedOutputFoldersParticipant is called. AddMappedOutputFoldersParticipant searches for all the source folders in the deployment assembly page, and for each source folder, finds the corresponding output folder, and adds the output folder (with all its contents, including all the .class files) to the list of IFlatResource resources to include in the resulting archive. In the scenario described in this defect, both source folders (ejbModule and test) are using the same output folder, and only ejbModule is in the Deployment assembly. So, when AddMappedOutputFoldersParticipant finds ejbModule, it adds its output folder and all its contents (including the .class files originated from compiling the source files in test source folder). If you set the output folder for the test source folder to a different folder, then the .class files corresponding to the java files in test source folder are not included in the resulting archive. We could try to filter the .class files when they are added by AddMappedOutputFoldersParticipant, and add only the files corresponding to source files in a source folder in deployment assembly, but this could be tricky, and possibly impact performance. This needs to be discussed, but in the mean time I'm targeting to 3.7
*** Bug 402887 has been marked as a duplicate of this bug. ***
*** Bug 459907 has been marked as a duplicate of this bug. ***
Too late for 3.7. Moving to 3.7.1, and adding the helpwanted keyword, in case somebody is interested in providing a patch.