Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 270800

Summary: Projects not being packaged (as jar) to the LIB folder of an EAR
Product: [WebTools] WTP Java EE Tools Reporter: Sarabjit S. Rupaal <sarabjit.rupaal>
Component: jst.j2eeAssignee: jst.j2ee <jst.j2ee-inbox>
Status: RESOLVED DUPLICATE QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: gorkem.ercan, kaloyan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sarabjit S. Rupaal CLA 2009-04-01 10:49:21 EDT
Build ID: M20090211-1700

Steps To Reproduce:
I am using "Eclipse-JEE-GANYMEDE-SR2-win32" (also with 3.4.0 Build ID I20080617-2000) for development and also using the EE Server Adapter Tools (wst:3.0.1.v20080730-4-CF_kE77c7SCI58GJ & jst:3.0.4.v20090115-787KEKGDUUEFEFnPb58GJ) for deploy/debug the projects to the server from the "Servers" tab. 

I Observed that the structure of the packaged EAR, when we publish it to the defined server (JBoss v4.2 / v5.0 in my case) is corrupt. The utility projects meant to go into the lib folder as jar in an EAR are not being packaged correctly.

Here are the steps to reproduce.

1) Create a Server Runtime for JBoss Server v4.2 / v5.0.
2) Also Define a New JBoss Server to publish & deploy/debug projects.
3) Create an EJB, WEB & EAR projects, add WEB & EJB projects to the EAR module.
4) Create a new utility project (say MyUtil)
5) Add the "MyUtil" project to the EAR from the EAR properties Dialog (Java EE Module Dependencies view).
6) Ensure the CheckBox corresponding to "In Lib Dir" for the MyUtil project is selected. Exit the EAR properties dialog after saving.
7) From the Project Explorer, expand the EAR project tree to ensure MyUtil.jar is placed in the lib as: ProjectEAR->Deployment Descriptor->Bundled Libraries->Library Directory(/lib as default)->MyUtil.jar
8) Using the tools from the Servers tab, Add the EAR project to the server (defined in step 2) and Publish it.
9) Now check the contents of the deployed EAR from the deploy location of the Server.

The "MyUtil.jar" is NOT PLACED IN THE LIB FOLDER but is packaged on the root along with WAR & ejb.jar.

Alternatively if I Export the EAR from the Eclipse File menu, the EAR is packaged correctly and MyUtil.jar is placed in the lib folder as expected.

Regards
Sarabjit S. Rupaal

More information:
I have not tried it with server adaptor other than JBoss 4.2 & 5.0.
Comment 1 Gorkem Ercan CLA 2009-05-02 16:26:27 EDT
I am using the o.e.jst.server.core.IEnterpriseApplication.getURI() to determine the location inside the ear. This interface is implemented by J2EEFlexProjDeployable and the getURI() does not return the lib directory in this case. I do not see any alternate way to determine URI. Passing on the J2EE tools team
Comment 2 Kaloyan Raev CLA 2009-05-11 05:57:35 EDT
This seems to be a duplicate to bug 241466. 
Please, also see bug 265798 where more general solution is being discussed. 

*** This bug has been marked as a duplicate of bug 241466 ***