facebook

Auto update of classpath?

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #197359 Reply

    I am evaluating MyEclipse with Eclipse 2.1.1 as a possible replacement for JBuilder 8. One of the annoying things I have found is that my classpath automatically gets updated when new jars are copied into the WEB-INF/lib directory. Is this by design? Can we turn it off?

    I have a few jars that are required at run time but should not be referenced by the project itself. I also hate seeing my jars show up twice in the package explorer. Help!

    Thanks,
    Lance

    #197363 Reply

    support-michael
    Keymaster

    One of the annoying things I have found is that my classpath automatically gets updated when new jars are copied into the WEB-INF/lib directory. Is this by design? Can we turn it off?

    1) MyEclpse automatically adds all jars in a web project’s WEB-INF/lib directory to the project’s classpath. This is consistent with our approach to minimize the delta between the development and runtime environments. Most developer’s expect this behavior. If MyEclipse omitted this then a typical web project would have numerous compilation errors without the user manually managing the classpath of his project.

    2) I’m trying to understand the problem. Can you elaborate on the need for jars in your project that you don’t compile against? Is having these jars on your classpath in a manner similar to that of an appserver causing development problems?

    3) Try using filters in the package-explorer to filter out display of redundant lib entries.

    Michael
    MyEclipse Support

    #197366 Reply

    1) WEB-INF/lib contains the jars required to run the application; not necessarily the jars to compile the application. A simple example is servlet.jar; you need it to compile but you do not want to deploy it with your web application.

    2) To continue with the reasoning behind this need: I need Oracle drivers to run the application, but not to compile it. Furthermore, I cannot post Oracle’s drivers in a open source project on sourceforge in our <project>/lib directory. Another example is where our code is written to an API (e.g. interfaces) and an implementation of these interfaces must be included at run time, but again should not be referenced during compile time (mainly to avoid mistakes of coding against an implementation and not the interfaces). Different institutions will have their own implementations of these interfaces which are bound at run time. I hope this makes sense. 🙂

    3) I have check out the filtering features. Are you suggesting I create a filter like “WEB-INF/lib/*.jar”?

    Thanks,
    Lance

    #197369 Reply

    support-michael
    Keymaster

    The MyEclipse default policy is to automatically add all jars in the web-inf/lib directory to the project classpath when they are imported into that directory. While this typically will not cause any development problems it does populate the package-explorer with an extended list of libraries for which there is not a predefined filter to exclude project resident libraries.

    What I recommend for now is to manually remove the runtime libraries from the web project’s build properties. Here’s the process:

    1) Select the web project and from the context menu (right click menu) navigate to Properties > Java Built Path > Libraries page.

    2) Then remove any jars that should not be on the project build path. This action will not remove the jars from the web-inf/lib directory so they are still available for deployment.

    I am entering a couple of enhancement requests to provide users more control over what is automatically added to project classpath.

    Michael
    MyEclipse Support

    #197370 Reply

    That sounds good. I would like to see something as simple as a preference like: “Automatically add WEB-INF/lib libraries to classpath?” –> YES/NO?

    Thanks!
    Lance

    #197371 Reply

    support-michael
    Keymaster

    Your suggestion is exactly what I proposed to development.

    Thanks,

    Michael
    MyEclipse Support

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Auto update of classpath?

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