@@ -2,46 +2,15 @@ package io.spring.gradle.convention
2
2
3
3
import org.gradle.api.Plugin
4
4
import org.gradle.api.Project
5
+ import org.gradle.api.plugins.JavaPlatformPlugin
5
6
import org.sonarqube.gradle.SonarQubePlugin
6
7
import org.springframework.gradle.maven.SpringMavenPlugin
7
8
8
9
public class MavenBomPlugin implements Plugin<Project > {
9
10
static String MAVEN_BOM_TASK_NAME = " mavenBom"
10
11
11
12
public void apply (Project project ) {
12
- project. configurations {
13
- archives
14
- }
13
+ project. plugins. apply(JavaPlatformPlugin )
15
14
project. plugins. apply(SpringMavenPlugin )
16
-
17
- project. group = project. rootProject. group
18
- project. task(MAVEN_BOM_TASK_NAME , type : MavenBomTask , group : ' Generate' , description : ' Configures the pom as a Maven Build of Materials (BOM)' )
19
- project. tasks. uploadArchives. dependsOn project. mavenBom
20
- project. tasks. artifactoryPublish. dependsOn project. mavenBom
21
-
22
- project. plugins. withType(SonarQubePlugin ) {
23
- project. sonarqube. skipProject = true
24
- }
25
-
26
- project. rootProject. allprojects. each { p ->
27
- p. plugins. withType(SpringMavenPlugin ) {
28
- if (! project. name. equals(p. name)) {
29
- project. mavenBom. projects. add(p)
30
- }
31
- }
32
- }
33
-
34
- def deployArtifacts = project. task(" deployArtifacts" )
35
- deployArtifacts. group = ' Deploy tasks'
36
- deployArtifacts. description = " Deploys the artifacts to either Artifactor or Maven Central"
37
- if (Utils . isRelease(project)) {
38
- deployArtifacts. dependsOn project. tasks. uploadArchives
39
- } else {
40
- deployArtifacts. dependsOn project. tasks. artifactoryPublish
41
- }
42
-
43
- project. artifacts {
44
- archives project. mavenBom. bomFile
45
- }
46
15
}
47
16
}
0 commit comments