Article updated on

Use project as dependency of a web Project in Eclipse

With Eclipse you can use a source project and compile directly into a web project. Every time you change your dependency project a new Jar will be stored in your web project build path. This is very convenient if you are developing libraries for web projects.

  • Create a Java Aplication Project and create a class that you will use later.

img/0/79/Selection_015.jpeg

  • Create a new Dynamic Web Project and create a JSP or class that will use your dependency.

img/0/79/Selection_035.jpeg

  • Right click on your Web Project and go to properties  > Deployment Assembly > Add a new assembly directy (Choose your Dependency Project).

img/0/79/Selection_021.jpeg

img/0/79/Selection_022.jpeg

  • Right click on your Web Project and go to properties  > Java Build Path > Projects > Add (Choose your Dependency Project).

img/0/79/Selection_023.jpeg

  • Right click on your Web Project and go to properties  >Project References (Make sure your Dependency Project is checked).

img/0/79/Selection_024.jpeg

  • Right. Clean and Rebuild your project if needed. To double check it run your project or export as WAR file. Open your war file and a Project Dependency packed in a JAR should be there.

img/0/79/Selection_026.jpeg