facebook

MyEclipse, jboss: how to exclude jar libraries from build

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #281241 Reply

    cmaessen
    Member

    For 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?

    #281249 Reply

    Loyal Water
    Member

    cmaessen,
    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

    #281287 Reply

    cmaessen
    Member

    I 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: off

    Using 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.

    #281288 Reply

    cmaessen
    Member

    And 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?

    #281290 Reply

    cmaessen
    Member

    Found 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: off

    Then everything works like a charm again.

    #281292 Reply

    Loyal Water
    Member

    Glad you got it to work. Thanks for letting me know.

    #283148 Reply

    Tom Howland
    Member

    This message has not been recovered.

    #283156 Reply

    Loyal Water
    Member

    This message has not been recovered.

    #311879 Reply

    danosborne
    Participant

    Ah, 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

    #311880 Reply

    danosborne
    Participant

    Ah, 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

    #311900 Reply

    support-joy
    Member

    Dan,

    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.

    #311979 Reply

    danosborne
    Participant

    That’s brilliant – many thanks!

    Dan

    #312081 Reply

    support-joy
    Member

    Dan,

    Good to hear you are all set.

    Best.

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: MyEclipse, jboss: how to exclude jar libraries from build

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in