Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363803 - Export of Java EE projects ignore removed source directories in Deployment Assembly
Summary: Export of Java EE projects ignore removed source directories in Deployment As...
Status: ASSIGNED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords: helpwanted
: 402887 459907 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-15 06:50 EST by Philippe CLA
Modified: 2015-05-27 11:14 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe CLA 2011-11-15 06:50:39 EST
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…
Comment 1 Kaloyan Raev CLA 2011-11-18 04:57:15 EST
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.
Comment 2 Roberto Sanchez Herrera CLA 2014-12-29 13:23:58 EST
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
Comment 3 Roberto Sanchez Herrera CLA 2014-12-29 13:45:48 EST
*** Bug 402887 has been marked as a duplicate of this bug. ***
Comment 4 Roberto Sanchez Herrera CLA 2015-02-13 14:05:07 EST
*** Bug 459907 has been marked as a duplicate of this bug. ***
Comment 5 Roberto Sanchez Herrera CLA 2015-05-27 11:14:22 EDT
Too late for 3.7. Moving to 3.7.1, and adding the helpwanted keyword, in case somebody is interested in providing a patch.