|tomcat and WTP: How to get dependent libraries into WEB-INF/lib [message #552136]
||Wed, 11 August 2010 00:11
Registered: August 2010
Hi I am trying to use eclipse (Helios) WTP to develop/deploy my webapp on tomcat.|
I created a Dynamic Web Project (projectA) and Created a new Tomcat Server and deployed the Dynamic Web Project on this server. Works great. However if I add any dependent libraries to projectA (e.g. Hibernate/Spring etc) these libraries are not getting automatically copied to the WEB-INF/lib directory. I am having to go to the file system and having to manually copy these to WEB-INF/lib for the tomcatServer (that I start from within eclipse) to find these. Any way of getting all my dependent external jars automatically deployed?
|Re: tomcat and WTP: How to get dependent libraries into WEB-INF/lib [message #555103 is a reply to message #554964]
||Wed, 25 August 2010 09:09
| Larry Isaacs
Registered: July 2009
On 8/24/2010 7:20 PM, Dean Hiller wrote:|
> I am upgrading from galileo and this seems to have broke everything :(
> :(. I have a project with no errors/problems in the problems tab right
> now(ie. added jars to build path). I then tried to add some of those
> same jars to Module Assembly...they don't show up in that Web Apps
> folder in the build path though. Lastly, they are not deployed to
> WEB-INF/lib so Module Assembly doesn't seem to do anything.
> Also, it would be fantastic in eclipse(not just WTP) if we could just
> specify something like all my jars are in this one folder so if I add
> remove jars, Ant AND Eclipse both pick it up rather than I have to go
> into eclipse and add another jar(same with WTP)...for some reason, they
> like to make us work in this area while ant made that nice and clean
> with a simple pattern. (note: I don't mind having to just refresh the
> project after adding 10 jars...I do mind having to go in and add the 10
> My current .settings/*.component file is like so...
> <?xml version="1.0" encoding="UTF-8"?>
> <project-modules id="moduleCoreId" project-version="1.5.0">
> <wb-module deploy-name="portal">
> <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
> <dependent-module archiveName="activation-1.1.jar" deploy-path="/"
> handle=" module:/classpath/lib/portal/src/libinclude/activation-1.1.j ar ">
> <property name="context-root" value="portal"/>
> <property name="java-output-path"/>
> it does not deploy activation-1.1.jar :( :(
Right now, your *.component file is set to put the activation-1.1.jar in
the root of your web application (i.e. deploy-path="/") instead of
WEB-INF/lib. At the moment, the WTP code handling this isn't smart
enough to know that activation-1.1.jar should *not* be automatically
included in your project's build classpath if not mapped to WEB-INF/lib.
If it was smart enough, you probably would have already realized
something wasn't right with this jar. If you use the Deployment
Assembly page to change the deploy-path to "/WEB-INF/lib", I believe it
will behave as you expect.
Perhaps a better way to add such jar(s) (better as in better supported
in the future) is to add them using the Java Build Path Libraries tab
and export the jar(s) in the Order and Export tab. Then switch to the
Problems view. A warning will appear related to the jar(s). Use the
Quick Fix to mark the jar(s) for inclusion in WEB-INF/lib. This
approach puts the jar in the .classpath file and adds an attribute to
that entry to mark it for inclusion in the web application when
published or exported.
|Re: tomcat and WTP: How to get dependent libraries into WEB-INF/lib [message #555917 is a reply to message #555695]
||Mon, 30 August 2010 04:10
| Mauro Molinari
Registered: July 2009
Il 27/08/2010 18.55, Larry Isaacs ha scritto:|
> That's the simplest way, but results in jar duplication, which is why I
> think many want to reference the jar where it already exists. For those
> with multiple projects that they want to ensure are all using the same
> version of a particular jar, having only one copy of the jar on the
> system helps ensure that.
To solve this problem I do the following. It's not very elegant but it
I create a Java project containing all the JARs I want to share.
Then, in all my dynamic web projects that need to use those JARs, I
create a linked "lib" folder in WEB-INF that points to the shared
In this way, if I want to update JARs from the CVS I simply need to
operate on the shared JARs project. Whenever I update files in it
(including adding new ones), the linked "lib" folders in the DWPs gets
updated automatically and so does the buildpath of each DWP.
I find this more confortable than the old buggy JEE Module Dependencies
project of the new Module Assembly Page (which is great for mapping more
"WebContent" folders, though).
Powered by FUDForum
. Page generated in 0.02413 seconds