[英]How to add and use one project in another project?
I have a project based on Spring which is running successfully. 我有一个基于Spring的项目,该项目正在成功运行。 Now I have created another project based on Jersey which I want to integrate with spring project in Jersey. 现在,我创建了另一个基于Jersey的项目,我想将其与Jersey的spring项目集成。
I have gone through internet and I added spring project in the build-path of the Jersey project. 我已经浏览了Internet,并在Jersey项目的构建路径中添加了spring项目。
Here the problem is whenever I run my Jersey project, it has to execute the Spring project first. 这里的问题是,每当我运行Jersey项目时,它都必须先执行Spring项目。
How to configure spring project in Jersey? 如何在Jersey中配置spring项目?
You should consider using a dependency management/build tool such as Maven or Gradle . 您应该考虑使用诸如Maven或Gradle之类的依赖项管理/构建工具。
This way each of your projects will be a module, which can be referenced from the other project as a dependency. 这样,您的每个项目都将是一个模块,可以从另一个项目中将其作为依赖项进行引用。 You can still use the first project alone and the two-dependent projects alone as wall. 您仍然可以单独使用第一个项目,也可以单独使用两个依赖项目。 Then the tool lets you just simply package the resulting project in a artifact such as WAR with all the dependencies. 然后,该工具使您可以简单地将生成的项目打包到带有所有依赖项的工件(例如WAR)中。
Here is a quick maven tutorial - Maven in 5 Minutes 这是一个快速的Maven教程-5分钟内的Maven
It is a good idea to use such a tool in any case as it has many additional advantages: 在任何情况下都使用这种工具是一个好主意,因为它具有许多其他优点:
Make both of your projects modules of one Maven parent pom project. 制作一个Maven父pom项目的两个项目模块。 This way you can build them both at the same time. 这样,您可以同时构建它们两者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.