随笔 - 79,  文章 - 0,  评论 - 1,  阅读 - 45386

1. 安装

  安装gradle,配置环境变量,查看版本

 

 

2. 在IDEA中创建gradle聚合项目配置

  build.gradle文件配置

复制代码
// 配置allprojects后就可以在所有的子项目中使用父项目中的模块
allprojects {
    apply plugin: 'java'

    group 'com.lewang'
    version '1.0-SNAPSHOT'

    sourceCompatibility = 1.8

    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
        implementation group: 'org.springframework', name: 'spring-context', version: '5.3.19'
    }

    task"create-dirs" << {

        sourceSets*.java.srcDirs*.each {

            it.mkdirs()

        }

        sourceSets*.resources.srcDirs*.each {

            it.mkdirs()

        }
    }
}
复制代码

 

  父项目settings.gradle中可以看到子项目

rootProject.name = 'gradle-parent'
include 'gradle-dao'
include 'gradle-service'
include 'gradle-web'
include 'gradle-webapp'

 

  父项目中已经有的就可以不用在子项目中再次配置了

  需要在子项目中引用的需要单独配置

  gradle-webapp的build.gradle文件配置
//配置子项目是web项目
apply plugin: 'war'

//可以在子模块中引用其他子模块
dependencies {
    compile project(":gradle-service")
}

 

posted on   homle  阅读(60)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示