在eclipse上用gradle导入另一个项目的项目

时间:2022-06-11 22:57:44

I'm trying to use Gradle as Spring MVC project builder. I divide my project in two distinct ones, the first project will contain the Repository and service part, and the second one, the views and controllers (web part)

我正在尝试使用Gradle作为Spring MVC项目构建器。我将项目划分为两个不同的项目,第一个项目将包含存储库和服务部分,第二个项目包含视图和控制器(Web部分)

My problem is when I try to deploy my project, the server don't see the entities from the first project. It also doesn't deploy this first project.

我的问题是当我尝试部署我的项目时,服务器看不到第一个项目中的实体。它也没有部署第一个项目。

I think it due to Gradle, but I don't know how to indicate to gradle to import the first project on the second one.

我认为这是由于Gradle,但我不知道如何指示gradle在第二个项目上导入第一个项目。

1 个解决方案

#1


You have to create a multi project with the following hirarchy:

您必须使用以下hirarchy创建一个多项目:

  • Root Project
    • settings.gradle
    • service
      • build.gradle
      • ...
    • service build.gradle ...

    • web
      • build.gradle
      • ...
    • web build.gradle ...

  • 根项目settings.gradle服务build.gradle ... web build.gradle ...

The settings.gradle has to include the following

settings.gradle必须包含以下内容

include 'service'
include 'web'

Now the web project can use the service project with the following code in the build.gradle:

现在,Web项目可以在build.gradle中使用带有以下代码的服务项目:

dependencies {
    compile project(':service')
}

#1


You have to create a multi project with the following hirarchy:

您必须使用以下hirarchy创建一个多项目:

  • Root Project
    • settings.gradle
    • service
      • build.gradle
      • ...
    • service build.gradle ...

    • web
      • build.gradle
      • ...
    • web build.gradle ...

  • 根项目settings.gradle服务build.gradle ... web build.gradle ...

The settings.gradle has to include the following

settings.gradle必须包含以下内容

include 'service'
include 'web'

Now the web project can use the service project with the following code in the build.gradle:

现在,Web项目可以在build.gradle中使用带有以下代码的服务项目:

dependencies {
    compile project(':service')
}