gradle 构建springboot 2.6.6分模块项目 其中公共模块依赖lombok插件
时间: 2023-08-11 07:08:33 浏览: 186
构建Spring Boot 2.6.6分模块项目并在公共模块中使用lombok插件,可以按照以下步骤进行:
首先,在项目根目录下创建一个settings.gradle文件,用于声明多个子项目:
```
rootProject.name = 'my-spring-boot-project'
include 'common'
include 'web'
```
在此示例中,我们将创建两个子项目:common和web。
接下来,在common子项目的build.gradle文件中,添加以下内容:
```
plugins {
id 'java'
id 'io.freefair.lombok' version '6.2.0'
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
// 添加其他依赖项
}
```
在这里,我们使用了io.freefair.lombok插件,该插件提供了对lombok注解的支持。同时,我们还声明了对Spring Boot框架的依赖。
在web子项目的build.gradle文件中,添加以下内容:
```
plugins {
id 'org.springframework.boot' version '2.6.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
dependencies {
implementation project(':common')
// 添加其他依赖项
}
```
在这里,我们使用了Spring Boot Gradle插件和Spring Boot依赖管理插件,以便在web模块中使用Spring Boot框架。同时,我们还声明了对common模块的依赖。
最后,在根目录下运行gradle build命令,Gradle将会构建所有子项目,并在web子项目的build/libs目录下生成可执行的jar文件。
这样就完成了Spring Boot 2.6.6分模块项目的构建,并在公共模块中使用了lombok插件。
阅读全文
相关推荐


















