Java Web Project referencing another Java project

后端 未结 5 1034
故里飘歌
故里飘歌 2020-12-13 22:37

I have a Java Project, for which I\'m now creating a Web interface, using a Dynamic Web Project from Eclipse. The Web project consists of a single

5条回答
  •  温柔的废话
    2020-12-13 22:59

    Under Eclipse, you can declare Project References for a given project, the web application in your case. To do so, right click on your web application project, then go for Properties > Project References and select the JavaApplication project. This should allow you to call code from the JavaApplication project from the WebApplication without having to build a WAR. This is a solution for development.

    For standard deployment (outside the IDE), you should indeed create a standard WAR. To do so, you'll have to package your JavaApplication as a JAR including the .class files and the files under /resources but not the libraries it depends on (JARs under /lib). These dependencies will actually end up in the WEB-INF/lib directory of the WAR, beside the JAR of your JavaApplication. These steps are typically automated with tools like Ant or Maven.

提交回复
热议问题