Wednesday, March 23, 2011

How to work with referenced projects in eclipse

Ok maybe everybody knows how to do this, but I've never try it beacause I've never needed it so, how do you work with multiple referenced projects in eclipse? I have a couple of Struts 1 web applications that must use another struts 1 "library" project and right now I'm doing the communication between them using url requests, wich is really annoying (at least how I have implemented it).

I would like to be able to use the classes of the "library" project directly in my other struts applications.

So far I know there are supposed to be in the same workspace and that I must reference using the "project references" options in the project properties, but that's it! I really don't know what to do next.

Thanks!

From stackoverflow
  • Projects Menu -> properties

    Go to the Java Build Path.

    There, you can either add the library directly or add another project into the build path of the current project.

  • Ok, that did it! Now when I export the struts application in a WAR file what is going to happen to the struts library application? Do I need to export both in separate WAR files or just by exporting the primary applicacion WAR will export also all the files of the library web application?

  • You probably just need the necessary jar files and either include them with your WAR, or add them to your Application Server (many have different ways of doing this).

    Another option is to bundle each WAR in one EAR file. This approach won't work on Tomcat, but will work on WebSphere, WebLogic ...

0 comments:

Post a Comment