- This topic has 12 replies, 5 voices, and was last updated 14 years, 2 months ago by support-joy.
-
AuthorPosts
-
cmaessenMemberFor one of our projects we’re using the MyEclipse 5.5 Enterprise Java Project to develop the software.
The issue we have with this type of project is that during the MyEclipse build process externally referenced jar’s are added to the war in WEB-INF/lib.
We don’t want to add certain jars to our ear as these should be loaded from the default/lib folder from our JBoss server. When the library is added to our ear this causes a linkage error on execution of code that uses the library (JBoss 4.2.0 can’t distinguish between 2 exactly the same libraries and fails with an error).How can we configure the Enterprise Java Project in such a way that MyEclipse doesn’t include certain libraries in the ear during build/deploy?
Loyal WaterMembercmaessen,
You should Add your jars in a Java project and then add the Java projects as a reference to your EAR project. You can handle the dependent Java Project deployment policy by going to Windows > Preferences > MyEclipse > Java Enterprise Project > Ear Project. You can now make sure the jars are not deployed along with the project. Here is a quickstart doc for your reference.
http://www.myeclipseide.com/documentation/quickstarts/earprojects/#advanced_features
cmaessenMemberI followed the instructions you gave but MyEclipse gave compile errors on classes that used the jar and still included the library in the .EAR.
However with the help of the page you mentioned I succeeded in finding a solution for my problem.
I placed the libraries I don’t want to include in the .EAR in a user library, and added this user library to my EJB en WEB projects of my Enterprise Application Project.
Then in the properties of the Enterprise Application Project () (MyEclipse > EAR) for Library Deployment Policies I applied the following settings:
Use workbench default settings: off
Jars exported from dependent Java projects: on
User libraries exported from dependent Java projects: offUsing these settings the project compiles perfectly and the jars in the user library aren’t included in the .EAR.
However, if you want to run the application correctly you should copy the jars that are used in the user library to the following location on you JBoss server: server/default/lib (assuming you’re using the default server).
With this the application runs perfectly.
cmaessenMemberAnd now suddenly it doesn’t work anymore.
MyEclipse again adds the jar to the .EAR file. And my settings are exactly the same as mentioned above, so it seems that MyEclipse is suddenly ignoring my project settings.
How can I correct this?
cmaessenMemberFound the problem, for some reason MyEclipse suddenly used the global settings for compilation of the .EAR.
What you also need to change if this occurs is the following are the following settings in Window > preferences > MyEclipse > Java Enterprise Project > Web project > Deploment (tab) > Library Deployment Policies options:
-Jars on Web Project build-path: on
-Jars in Web Project user libraries: off
-Jars exported from dependent Java projects: on
-User library jars exported from dependent Java projects: offThen everything works like a charm again.
Loyal WaterMemberGlad you got it to work. Thanks for letting me know.
Tom HowlandMemberThis message has not been recovered.
Loyal WaterMemberThis message has not been recovered.
danosborneParticipantAh, hope it’s OK to hijack this thread – I have the exact same problem but am using a Web Project rather than an EAR – is it still possible to exclude user libraries on deployment?
Dan
danosborneParticipantAh, hope it’s OK to hijack this thread – I have the exact same problem but am using a Web Project rather than an EAR – is it still possible to exclude user libraries on deployment?
Dan
support-joyMemberDan,
If you have added the libraries you would like to exclude on deployment in a user library; you can try this approach – Open MyEclipse IDE, from menu options click on Window > Preferences > MyEclipse > Java Enterprise Project > Web Project. Choose the Deployment tab. Under Library Deployment Policies uncheck “Jars from User Libraries”. Click on [Apply] and [OK]. Deploy your project. User library would be excluded.
Best.
danosborneParticipantThat’s brilliant – many thanks!
Dan
support-joyMemberDan,
Good to hear you are all set.
Best.
-
AuthorPosts