1. 阿里云效服务:
https://maven.aliyun.com/mvn/guide
2. 配置
buildscript { //此配置必须在plugins之前,用于引入社区的构建插件
repositories {
mavenLocal()
maven {url 'https://maven.aliyun.com/repository/central'}
maven {url 'https://maven.aliyun.com/repository/public'}
maven {url 'https://maven.aliyun.com/repository/google'}
maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven {url 'https://maven.aliyun.com/repository/spring'}
maven {url 'https://maven.aliyun.com/repository/spring-plugin'}
maven {url 'https://maven.aliyun.com/repository/apache-snapshots'}
mavenCentral()
jcenter()
google()
}
}
plugins {
id 'java' //java 核心插件
id 'org.springframework.boot' version '2.4.2' //springboot社区插件
}
//allProjects { 如果是父项目
repositories {
mavenLocal()
maven {url 'https://maven.aliyun.com/repository/central'}
maven {url 'https://maven.aliyun.com/repository/public'}
maven {url 'https://maven.aliyun.com/repository/google'}
maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven {url 'https://maven.aliyun.com/repository/spring'}
maven {url 'https://maven.aliyun.com/repository/spring-plugin'}
maven {url 'https://maven.aliyun.com/repository/apache-snapshots'}
mavenCentral()
jcenter()
google()
}
//}
可在命令行,直接使用 ./gradlew dependencies
进行依赖的引入
3. springboot插件
完整的包为:
org.springframework.boot:spring-boot-gradle-plugin:2.4.2
配置相当于maven中如下配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2.RELEASE</version>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
网友评论