6

I've got a simple Dynamic Web project set up in Eclipse 3.6 Helios, but am having trouble getting it to make use of the code in another project that I've got.

I've added a reference to my other project to the build path of my web project, and I've got no problems in terms of compiling, only in terms of deploying and testing the result. The built web application doesn't have a jar in the WEB-INF/lib directory, so fair enough it can't find the code. The question is how I set this up. I've looked through the help that I can find and googled a bit but can't find anything obvious that helps out.

How do I set up my web project so that on deploying it it magically has the code from my dependent project inside it?

Thanks.

Note: Ideally I'd like a solution that doesn't involve setting up some kind of build tool. The web project deploys itself without recourse to any build tool (or at least none visible to end user), so was rather hoping that a references project could be integrated into that easily.

Tom Quarendon
  • 5,625
  • 5
  • 23
  • 30

2 Answers2

10

What goes in the deployment is determined not by the build path but by the Deployment Assembly entry in Preferences for the dynamic web project.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • 1
    This is the correct answer. There is no need to use build scripts to accomplish this simple task. Just go to the Deployment Assembly and tell it to add entries from your build path. That tells the system that those build path entries also need to be packaged with your application, as opposed to those that you expect to be available on the target system. – Konstantin Komissarchik Jan 10 '11 at 18:20
  • OK. This was precisely what I was looking for. Thanks. – Tom Quarendon Jan 11 '11 at 16:02
  • This was introduced in 3.5 I think. – Thorbjørn Ravn Andersen May 04 '11 at 07:11
  • Splitting the project into source and framework(jar) parts is explained perfectly in eclipse help topic "Project using a source framework with restricted access".Plus, its necessary to insert the framework project in the source project build path "Projects" tag. Thanks ! – artejera Oct 26 '12 at 15:45
  • I can't help but think that Eclipse should know that if I add a web project to my web project as a dependency (ie, Properties,Java Build Path,Projects), that it should correctly deploy the dependency's web/* content and classes? I asked a similar question: http://stackoverflow.com/questions/15361509 *meh* – eugenevd Mar 12 '13 at 12:55
  • We are also facing same problem. I followed above steps but in my case build path entries showing empty.So please tell me where am i going wrong? – Ravi Chothe Dec 03 '14 at 06:34
  • We migrated to maven and let the Maven support in Eclipse handle it. – Thorbjørn Ravn Andersen Dec 03 '14 at 09:53
1

Use some build tool like ANT or Ivy or Maven that, on build, copies all the dependencies to WEB-INF/lib

Using a build tool is a good practice to automate build, test and deployment. You may also be interested in plug-ins like Maven Reactor.

Nishant
  • 54,584
  • 13
  • 112
  • 127