Fix MavenBom

This commit is contained in:
Rob Winch 2021-05-17 17:49:04 -05:00
parent 928c855a7d
commit c72f8dec0c
3 changed files with 13 additions and 59 deletions

View File

@ -1,4 +1,13 @@
import io.spring.gradle.convention.SpringModulePlugin
apply plugin: 'io.spring.convention.bom'
sonarqube.skipProject = true
dependencies {
constraints {
project.allprojects { p ->
p.plugins.withType(SpringModulePlugin) {
api p
}
}
}
}

View File

@ -2,6 +2,7 @@ package io.spring.gradle.convention
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlatformPlugin
import org.sonarqube.gradle.SonarQubePlugin
import org.springframework.gradle.maven.SpringMavenPlugin
@ -9,39 +10,7 @@ public class MavenBomPlugin implements Plugin<Project> {
static String MAVEN_BOM_TASK_NAME = "mavenBom"
public void apply(Project project) {
project.configurations {
archives
}
project.plugins.apply(JavaPlatformPlugin)
project.plugins.apply(SpringMavenPlugin)
project.group = project.rootProject.group
project.task(MAVEN_BOM_TASK_NAME, type: MavenBomTask, group: 'Generate', description: 'Configures the pom as a Maven Build of Materials (BOM)')
project.tasks.uploadArchives.dependsOn project.mavenBom
project.tasks.artifactoryPublish.dependsOn project.mavenBom
project.plugins.withType(SonarQubePlugin) {
project.sonarqube.skipProject = true
}
project.rootProject.allprojects.each { p ->
p.plugins.withType(SpringMavenPlugin) {
if (!project.name.equals(p.name)) {
project.mavenBom.projects.add(p)
}
}
}
def deployArtifacts = project.task("deployArtifacts")
deployArtifacts.group = 'Deploy tasks'
deployArtifacts.description = "Deploys the artifacts to either Artifactor or Maven Central"
if(Utils.isRelease(project)) {
deployArtifacts.dependsOn project.tasks.uploadArchives
} else {
deployArtifacts.dependsOn project.tasks.artifactoryPublish
}
project.artifacts {
archives project.mavenBom.bomFile
}
}
}

View File

@ -1,24 +0,0 @@
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.spring.gradle.convention;
/**
* @author Rob Winch
*/
public class SpringPomPlugin extends SpringModulePlugin {
}