| [news.eclipse.webtools] Re: How to make Eclipse put jars into WEB-INF/lib? |
Larry Isaacs ha scritto:For me, the selected jars stayed checked. As you have surmised, just including the jars in the build path doesn't by itself mark them for inclusion in WEB-INF/lib. Using the "J2EE Module Dependencies" page is the correct approach. However, it's not clear why they won't stay checked. You might check the Error Log view to see if something related is present. You could also try creating a new project, copy the lib directory, and see if you can duplicate this issue in the new project. If not, you can compare the ".classpath" and ".settings/org.eclipse.wst.common.component" files to see what the differences are. You could also try removing the jars from build path and adding them on the J2EE Module Dependencies page, which will automatically include them on the build path as well as include them in WEB-INF/lib.
Hi Larry,
just for my curiosity. In this post you're suggesting to add JARs to classpath and then to check them in J2EE Module Dependencies to have them deployed to WEB-INF/lib.
In my own experience, however, I learnt to follow a different approach. I simply put my JARs in WEB-INF/lib of WebContent: those JARs are automatically added to classpath (through Web App Libraries) AND deployed to WEB-INF/lib (I don't know if they are also exported to the WAR, as David asked). I prefer this approach for two main reasons:
1) it sounds more clean to me: I think the "Web App Libraries" Library in build path was actually designed for this purpose
2) the J2EE Module Dependencies property page is almost unusable: it's full of bugs, because sometimes things don't get checked, sometimes they don't get unchecked and sometimes there seem to be synchronization problems between that view and the Java Build Path property page.
Because of 1), in the past I wondered what J2EE Module Dependencies was made for... then I understood that it's useful when you have inter-project dependencies: when you define a Dynamic Web Project to depend on another project, that project is used to build the Dynamic Web Project, but its classes are not deployed to WEB-INF/lib of the Dynamic Web Project. Adding the required project to J2EE Module Dependencies causes WTP to make a JAR of it to deploy in WEB-INF/lib.
Correct me if I'm wrong in my approach: I would appreciate your opinion on this very much.
Cheers, Larry
Mauro.