Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib
tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557351] Tue, 07 September 2010 00:11 Go to next message
fatelephant is currently offline fatelephant
Messages: 7
Registered: August 2010
Junior Member
In a similar vein to
http://www.eclipse.org/forums/index.php?t=msg&th=173502
how do I get dependent projects into my WEB-INF/lib
I have a wtp project project1
and another project project2, which is a plain java project, just produces some .class files in its bin folder

Now I need project2 in project1 and so I mark this as so in the project1->java build path->projects tab. However this class files from project2 are not getting copied into WEB-INF/classes or WEB-INF/lib Any way to make that happen?

Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557363 is a reply to message #557351] Tue, 07 September 2010 02:54 Go to previous messageGo to next message
Kaloyan Raev is currently offline Kaloyan Raev
Messages: 183
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
In this case you should not use project1->java build path, but project1->deployment assembly.

On this page, click Add->Project->project2->Finish and check that the suggested deploy path is /WEB-INF/lib/project2.jar.

Note that in releases before Helios, the Deployment Assembly page is called Java EE Module Dependencies.
Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557365 is a reply to message #557351] Tue, 07 September 2010 02:58 Go to previous messageGo to next message
Kaloyan Raev is currently offline Kaloyan Raev
Messages: 183
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
I forgot to say that after executing the above you will still not see project2 as jar under project1/WEB-INF/lib in your Eclipse workspace. But if you deploy or export WAR it will be included there.

The Deployment Assembly page actually includes project2 in the Web App Libraries of project1. Then the compiler, the deploy mechanism and export WAR operation know how to deal with it.
Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557477 is a reply to message #557365] Tue, 07 September 2010 10:52 Go to previous messageGo to next message
fatelephant is currently offline fatelephant
Messages: 7
Registered: August 2010
Junior Member
Thanks for your response, I tried it and did notice that if I go to Project1->export->war file and create a war file, then the war file contains project2.jar. Great.
However for debugging, i also have a tomcat server that I start/stop from within eclipse, and I deploy project1 there. How do I get project2.jar into that deployment?

I want to add that in my experience, the export use case, while it is useful and clearly works, is not as useful since in all use of eclipse at various gigs that I have been, there is a separate ant or maven based build process for creating the war files meant to be deployed. And eclipse is used purely in the edit-compile-test cylce. For that getting the dependent projects to automatically be deployed (just as the main project is deployed to the Server) will be most useful.

[Updated on: Tue, 07 September 2010 11:03]

Report message to a moderator

Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557483 is a reply to message #557351] Tue, 07 September 2010 12:14 Go to previous messageGo to next message
Kaloyan Raev is currently offline Kaloyan Raev
Messages: 183
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
If you did what I suggested in my first comment, then the deployment/debugging should work just fine.

The Publish mechanism of WTP deploys the Web projects and all Java projects referenced in the Deployment Assembly page.
Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557543 is a reply to message #557483] Tue, 07 September 2010 23:38 Go to previous messageGo to next message
fatelephant is currently offline fatelephant
Messages: 7
Registered: August 2010
Junior Member
Kaloyen, It works great. Thanks a bunch. Really appreciate it.

BTW, I also had to add the project2 under Project1->Properties->Java Build Path->Projects without that, it would give compilation errors in java files of project1 classes of project2 are referenced

Best,
Re: tomcat and WTP: How to get class files from dependent projectsinto WEB-INF/lib [message #557569 is a reply to message #557351] Wed, 08 September 2010 02:55 Go to previous message
Kaloyan Raev is currently offline Kaloyan Raev
Messages: 183
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
I am glad that it works for you.

The additional reference Java Build Path > Projects should not be needed. If you have clear path to reproduce this problem, then please submit a bug report:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=WTP%20Ja va%20EE%20Tools

Please, include the exact steps to reproduce.
Previous Topic:programatically add jar to deployment assembly?
Next Topic:Context Root ignored?
Goto Forum:
  


Current Time: Mon Apr 21 08:51:50 EDT 2014

Powered by FUDForum. Page generated in 0.03721 seconds