Refactor and simplify Spring Build Conventions Gradle Plugins.
* Declare CHECKSTYLE_VERSION class member constant in the CheckstylePlugin. * Remove the PlublishLocalPlugin. * Replace use of the deprecated JavaPluginConvention with JavaPluginExtension in the JavadocApiPlugin. * Replace the EclipseWtpPlugin with the EclipsePlugin applied in the AbstractSpringJavaPlugin class. * Review and fix spelling error in CopyPropertiesPlugin Javadoc. * Review, refactor and polish the Spring Gradle PropDepsPlugins including PropDepsPlugins for IntelliJ IDEA and Eclipse.
This commit is contained in:
@@ -20,7 +20,7 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.GroovyPlugin
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.plugins.PluginManager
|
||||
import org.gradle.plugins.ide.eclipse.EclipseWtpPlugin
|
||||
import org.gradle.plugins.ide.eclipse.EclipsePlugin
|
||||
import org.gradle.plugins.ide.idea.IdeaPlugin
|
||||
import org.springframework.gradle.CopyPropertiesPlugin
|
||||
import org.springframework.gradle.propdeps.PropDepsEclipsePlugin
|
||||
@@ -78,7 +78,7 @@ abstract class AbstractSpringJavaPlugin implements Plugin<Project> {
|
||||
@SuppressWarnings("all")
|
||||
private void applyIdePlugins(PluginManager pluginManager) {
|
||||
|
||||
pluginManager.apply(EclipseWtpPlugin)
|
||||
pluginManager.apply(EclipsePlugin)
|
||||
pluginManager.apply(IdeaPlugin)
|
||||
}
|
||||
|
||||
@@ -90,17 +90,18 @@ abstract class AbstractSpringJavaPlugin implements Plugin<Project> {
|
||||
@SuppressWarnings("all")
|
||||
private void applySpringPlugins(PluginManager pluginManager) {
|
||||
|
||||
pluginManager.apply(ManagementConfigurationPlugin)
|
||||
pluginManager.apply(RepositoryConventionPlugin)
|
||||
pluginManager.apply(PropDepsPlugin)
|
||||
pluginManager.apply(PropDepsEclipsePlugin)
|
||||
pluginManager.apply(PropDepsIdeaPlugin)
|
||||
pluginManager.apply("io.spring.convention.springdependencymangement")
|
||||
pluginManager.apply("io.spring.convention.dependency-set")
|
||||
pluginManager.apply("io.spring.convention.repository")
|
||||
pluginManager.apply("io.spring.convention.javadoc-options")
|
||||
pluginManager.apply("io.spring.convention.tests-configuration")
|
||||
pluginManager.apply("io.spring.convention.integration-test")
|
||||
pluginManager.apply("io.spring.convention.jacoco");
|
||||
pluginManager.apply("io.spring.convention.checkstyle")
|
||||
pluginManager.apply(SpringDependencyManagementConventionPlugin)
|
||||
pluginManager.apply(DependencySetPlugin)
|
||||
pluginManager.apply(TestsConfigurationPlugin)
|
||||
pluginManager.apply(IntegrationTestPlugin)
|
||||
pluginManager.apply(JacocoPlugin);
|
||||
pluginManager.apply(JavadocOptionsPlugin)
|
||||
pluginManager.apply(CheckstylePlugin)
|
||||
pluginManager.apply(CopyPropertiesPlugin)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
/**
|
||||
* Applies the JFrag Artifactory Gradle {@link Plugin} to publish Gradle {@link Project} artifacts to
|
||||
* the Spring Artifactory Repositories.
|
||||
* Applies and configures the JFrag Artifactory Gradle {@link Plugin} to publish Gradle {@link Project} artifacts
|
||||
* to the Spring {@literal snapshot}, {@literal milestone} and {@literal release} repositories in Artifactory.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
@@ -39,7 +39,7 @@ class ArtifactoryPlugin implements Plugin<Project> {
|
||||
publish {
|
||||
repository {
|
||||
repoKey = resolveRepositoryKey(project)
|
||||
if (project.hasProperty('artifactoryUsername')) {
|
||||
if (isAuthRequired(project)) {
|
||||
username = artifactoryUsername
|
||||
password = artifactoryPassword
|
||||
}
|
||||
@@ -52,6 +52,10 @@ class ArtifactoryPlugin implements Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAuthRequired(Project project) {
|
||||
project.hasProperty('artifactoryUsername')
|
||||
}
|
||||
|
||||
private String resolveRepositoryKey(Project project) {
|
||||
|
||||
boolean isSnapshot = Utils.isSnapshot(project);
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.gradle.api.plugins.JavaPlugin
|
||||
class CheckstylePlugin implements Plugin<Project> {
|
||||
|
||||
static final String CHECKSTYLE_PATHNAME = 'etc/checkstyle'
|
||||
static final String CHECKSTYLE_VERSION = '8.21'
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
@@ -46,7 +47,7 @@ class CheckstylePlugin implements Plugin<Project> {
|
||||
|
||||
project.checkstyle {
|
||||
configDirectory = checkstyleDirectory
|
||||
toolVersion = '8.21'
|
||||
toolVersion = CHECKSTYLE_VERSION
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.gradle.api.Project
|
||||
*/
|
||||
class DeployDocsPlugin implements Plugin<Project> {
|
||||
|
||||
static final String DEFAULT_SPRING_DOCS_HOST = 'docs-ip.spring.io';
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
|
||||
@@ -42,7 +44,7 @@ class DeployDocsPlugin implements Plugin<Project> {
|
||||
|
||||
host = project.hasProperty('deployDocsHost')
|
||||
? project.findProperty('deployDocsHost')
|
||||
: 'docs-ip.spring.io'
|
||||
: DEFAULT_SPRING_DOCS_HOST
|
||||
|
||||
user = project.findProperty('deployDocsSshUsername')
|
||||
|
||||
@@ -50,17 +52,18 @@ class DeployDocsPlugin implements Plugin<Project> {
|
||||
? project.file(project.findProperty('deployDocsSshKeyPath'))
|
||||
: project.hasProperty('deployDocsSshKey')
|
||||
? project.findProperty('deployDocsSshKey')
|
||||
: identity
|
||||
: null
|
||||
|
||||
passphrase = project.hasProperty('deployDocsSshPassphrase')
|
||||
? project.findProperty('deployDocsSshPassphrase')
|
||||
: passphrase
|
||||
: null
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
project.task('deployDocs') {
|
||||
dependsOn 'docsZip'
|
||||
doFirst {
|
||||
dependsOn 'docs'
|
||||
doLast {
|
||||
project.ssh.run {
|
||||
session(project.remotes.docs) {
|
||||
|
||||
@@ -71,18 +74,20 @@ class DeployDocsPlugin implements Plugin<Project> {
|
||||
|
||||
execute "mkdir -p $tempPath"
|
||||
|
||||
project.tasks.docsZip.outputs.each { o ->
|
||||
put from: o.files, into: tempPath
|
||||
project.tasks.docsZip.outputs.each { out ->
|
||||
put from: out.files, into: tempPath
|
||||
}
|
||||
|
||||
execute "unzip $tempPath*.zip -d $tempPath"
|
||||
|
||||
def extractPath = "/var/www/domains/spring.io/docs/htdocs/autorepo/docs/${name}/${version}/"
|
||||
def extractPath =
|
||||
"/var/www/domains/spring.io/docs/htdocs/autorepo/docs/${name}/${version}/"
|
||||
|
||||
execute "rm -rf $extractPath"
|
||||
execute "mkdir -p $extractPath"
|
||||
execute "mv $tempPath/docs/* $extractPath"
|
||||
execute "chmod -R g+w $extractPath"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package io.spring.gradle.convention
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.plugins.PluginManager
|
||||
import org.gradle.api.tasks.bundling.Zip
|
||||
|
||||
@@ -32,20 +33,20 @@ class DocsPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
|
||||
PluginManager pluginManager = project.getPluginManager();
|
||||
PluginManager pluginManager = project.getPluginManager()
|
||||
|
||||
pluginManager.apply("org.asciidoctor.jvm.convert");
|
||||
pluginManager.apply("org.asciidoctor.jvm.pdf");
|
||||
pluginManager.apply(AsciidoctorConventionPlugin);
|
||||
pluginManager.apply(DeployDocsPlugin);
|
||||
pluginManager.apply(JavadocApiPlugin);
|
||||
pluginManager.apply("org.asciidoctor.jvm.convert")
|
||||
pluginManager.apply("org.asciidoctor.jvm.pdf")
|
||||
pluginManager.apply(AsciidoctorConventionPlugin)
|
||||
pluginManager.apply(DeployDocsPlugin)
|
||||
pluginManager.apply(JavadocApiPlugin)
|
||||
|
||||
Task docsZip = project.tasks.create('docsZip', Zip) {
|
||||
|
||||
archiveBaseName = project.rootProject.name
|
||||
archiveClassifier = 'docs'
|
||||
group = 'Distribution'
|
||||
description = "Builds -${archiveClassifier} archive containing all Docs for deployment at docs.spring.io."
|
||||
description = "Builds -${archiveClassifier} archive containing all documenation for deployment to docs-ip.spring.io."
|
||||
dependsOn 'api', 'asciidoctor'
|
||||
|
||||
from(project.tasks.api.outputs) {
|
||||
@@ -53,7 +54,7 @@ class DocsPlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
into 'docs'
|
||||
duplicatesStrategy 'exclude'
|
||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
Task docs = project.tasks.create("docs") {
|
||||
@@ -63,5 +64,6 @@ class DocsPlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
project.tasks.assemble.dependsOn docs
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ class IntegrationTestPlugin implements Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private boolean isIntegrationTestSourceAvailable(Project project) {
|
||||
return project.file('src/integration-test/').exists()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2022-present 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
|
||||
@@ -15,21 +15,26 @@
|
||||
*/
|
||||
package io.spring.gradle.convention
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
* Generates Javadoc API documentation for {@literal this} {@link Project}.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.api.plugins.JavaPluginExtension
|
||||
* @see org.gradle.api.tasks.javadoc.Javadoc
|
||||
*/
|
||||
class JavadocApiPlugin implements Plugin<Project> {
|
||||
|
||||
@@ -45,7 +50,7 @@ class JavadocApiPlugin implements Plugin<Project> {
|
||||
Javadoc api = project.tasks.create("api", Javadoc)
|
||||
|
||||
api.setGroup("Documentation")
|
||||
api.setDescription("Generates aggregated Javadoc API documentation.")
|
||||
api.setDescription("Generates Javadoc API documentation.")
|
||||
api.setDestinationDir(new File(project.getBuildDir(), "api"))
|
||||
api.setMaxMemory("1024m")
|
||||
|
||||
@@ -80,26 +85,22 @@ class JavadocApiPlugin implements Plugin<Project> {
|
||||
excludes.each {this.excludes.add(Pattern.compile(it)) }
|
||||
}
|
||||
|
||||
private void addProject(Javadoc api, Project project) {
|
||||
private void addProject(Javadoc javadoc, Project project) {
|
||||
|
||||
if (isProjectIncluded(project)) {
|
||||
|
||||
logInfo("Add sources for project {}", project)
|
||||
|
||||
project.getPlugins().withType(SpringModulePlugin.class).all { plugin ->
|
||||
project.getPlugins().withType(SpringModulePlugin).all { plugin ->
|
||||
|
||||
JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension)
|
||||
|
||||
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class)
|
||||
SourceSet mainSourceSet = java.getSourceSets().getByName("main")
|
||||
|
||||
api.setSource(api.getSource().plus(mainSourceSet.getAllJava()))
|
||||
javadoc.setSource(javadoc.getSource() + mainSourceSet.getAllJava())
|
||||
|
||||
project.getTasks().withType(Javadoc.class).all(new Action<Javadoc>() {
|
||||
|
||||
@Override
|
||||
void execute(Javadoc projectJavadoc) {
|
||||
api.setClasspath(api.getClasspath().plus(projectJavadoc.getClasspath()))
|
||||
}
|
||||
})
|
||||
project.getTasks().withType(Javadoc).all((Javadoc javadocTask) ->
|
||||
javadoc.setClasspath(javadoc.getClasspath() + javadocTask.getClasspath()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.gradle.propdeps.PropDepsPlugin;
|
||||
|
||||
/**
|
||||
* Creates a {@literal Management} Gradle {@link Configuration} that is appropriate for adding a platform
|
||||
* so that it is not exposed externally.
|
||||
* that it is not exposed externally.
|
||||
*
|
||||
* If the {@link JavaPlugin} is applied, then the {@literal compileClasspath}, {@literal runtimeClasspath},
|
||||
* {@literal testCompileClasspath}, and {@literal testRuntimeClasspath} will extend from it.
|
||||
@@ -73,9 +73,9 @@ public class ManagementConfigurationPlugin implements Plugin<Project> {
|
||||
|
||||
plugins.withType(MavenPublishPlugin.class, mavenPublishPlugin -> {
|
||||
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
PublishingExtension publishingExtension = project.getExtensions().getByType(PublishingExtension.class);
|
||||
|
||||
publishing.getPublications().withType(MavenPublication.class, mavenPublication ->
|
||||
publishingExtension.getPublications().withType(MavenPublication.class, mavenPublication ->
|
||||
mavenPublication.versionMapping(versions ->
|
||||
versions.allVariants(VariantVersionMappingStrategy::fromResolutionResult)));
|
||||
});
|
||||
|
||||
@@ -57,9 +57,6 @@ class MavenBomPlugin implements Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Why?
|
||||
Utils.configureDeployArtifactsTask(project)
|
||||
|
||||
// TODO: Shouldn't this be { archives project.mavenBom } according to:
|
||||
// https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#getArtifacts--
|
||||
// TODO: Is this even necessary since this block is defined in MavenBomTask?
|
||||
|
||||
@@ -18,6 +18,7 @@ package io.spring.gradle.convention
|
||||
import io.spring.nohttp.gradle.NoHttpPlugin
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.plugins.BasePlugin
|
||||
import org.gradle.api.plugins.PluginManager
|
||||
import org.springframework.gradle.maven.SpringNexusPublishPlugin
|
||||
@@ -47,19 +48,23 @@ class RootProjectPlugin implements Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
// Add Maven Central Repository (resolution) to the list of repositories used by this build
|
||||
// to resolve dependencies.
|
||||
// Adds the Maven Central Repository to the list of repositories used by this build to resolve dependencies.
|
||||
project.repositories.mavenCentral()
|
||||
|
||||
configureSonarQube(project)
|
||||
|
||||
project.tasks.create("dependencyManagementExport", DependencyManagementExportTask)
|
||||
|
||||
def finalizeDeployArtifacts = project.task("finalizeDeployArtifacts")
|
||||
project.task("releasePublishedArtifacts", { Task releasePublishedArtifacts ->
|
||||
if (isReleasingToMavenCentral(project)) {
|
||||
releasePublishedArtifacts.dependsOn project.tasks.closeAndReleaseOssrhStagingRepository
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Utils.isRelease(project) && project.hasProperty("ossrhUsername")) {
|
||||
finalizeDeployArtifacts.dependsOn project.tasks.closeAndReleaseOssrhStagingRepository
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
private boolean isReleasingToMavenCentral(Project project) {
|
||||
Utils.isRelease(project) && project.hasProperty("ossrhUsername")
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
* Copyright 2022-present 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
|
||||
@@ -19,11 +19,17 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
/**
|
||||
* Deploys the Spring XML schema (XSD) files to the spring.io server.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
*/
|
||||
class SchemaDeployPlugin implements Plugin<Project> {
|
||||
|
||||
static final String DEFAULT_SPRING_DOCS_HOST = 'docs-ip.spring.io';
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
|
||||
@@ -42,7 +48,7 @@ class SchemaDeployPlugin implements Plugin<Project> {
|
||||
|
||||
host = project.hasProperty('deployDocsHost')
|
||||
? project.findProperty('deployDocsHost')
|
||||
: 'docs.af.pivotal.io'
|
||||
: DEFAULT_SPRING_DOCS_HOST
|
||||
|
||||
user = project.findProperty('deployDocsSshUsername')
|
||||
|
||||
@@ -50,11 +56,11 @@ class SchemaDeployPlugin implements Plugin<Project> {
|
||||
? project.file(project.findProperty('deployDocsSshKeyPath'))
|
||||
: project.hasProperty('deployDocsSshKey')
|
||||
? project.findProperty('deployDocsSshKey')
|
||||
: identity
|
||||
: null
|
||||
|
||||
passphrase = project.hasProperty('deployDocsSshPassphrase')
|
||||
? project.findProperty('deployDocsSshPassphrase')
|
||||
: passphrase
|
||||
: null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +77,9 @@ class SchemaDeployPlugin implements Plugin<Project> {
|
||||
|
||||
execute "mkdir -p $tempPath"
|
||||
|
||||
project.tasks.schemaZip.outputs.each { o ->
|
||||
println "Putting $o.files"
|
||||
put from: o.files, into: tempPath
|
||||
project.tasks.schemaZip.outputs.each { out ->
|
||||
println "Putting $out.files"
|
||||
put from: out.files, into: tempPath
|
||||
}
|
||||
|
||||
execute "unzip $tempPath*.zip -d $tempPath"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
* Copyright 2022-present 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
|
||||
@@ -19,14 +19,18 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
/**
|
||||
* Gradle {@link Plugin} to ZIP and deploy Spring XML schemas (XSDK) files.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
*/
|
||||
class SchemaPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.getPluginManager().apply(SchemaDeployPlugin)
|
||||
project.getPluginManager().apply(SchemaZipPlugin)
|
||||
project.getPluginManager().apply(SchemaDeployPlugin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,17 @@ package io.spring.gradle.convention
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.tasks.bundling.Zip
|
||||
|
||||
/**
|
||||
* Zips all Spring XML schemas (XSD) files.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
*/
|
||||
class SchemaZipPlugin implements Plugin<Project> {
|
||||
|
||||
@@ -33,8 +38,8 @@ class SchemaZipPlugin implements Plugin<Project> {
|
||||
|
||||
schemaZip.archiveBaseName = project.rootProject.name
|
||||
schemaZip.archiveClassifier = 'schema'
|
||||
schemaZip.description = "Builds -${schemaZip.archiveClassifier} archive containing all " +
|
||||
"XSDs for deployment at static.springframework.org/schema."
|
||||
schemaZip.description = "Builds -${schemaZip.archiveClassifier} archive containing all XSDs" +
|
||||
" for deployment to static.springframework.org/schema."
|
||||
schemaZip.group = 'Distribution'
|
||||
|
||||
project.rootProject.subprojects.each { module ->
|
||||
@@ -49,9 +54,9 @@ class SchemaZipPlugin implements Plugin<Project> {
|
||||
|
||||
for (def key : schemas.keySet()) {
|
||||
|
||||
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
|
||||
def zipEntryName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
|
||||
|
||||
assert shortName != key
|
||||
assert zipEntryName != key
|
||||
|
||||
File xsdFile = module.sourceSets.main.resources.find {
|
||||
it.path.endsWith(schemas.get(key))
|
||||
@@ -59,8 +64,8 @@ class SchemaZipPlugin implements Plugin<Project> {
|
||||
|
||||
assert xsdFile != null
|
||||
|
||||
schemaZip.into (shortName) {
|
||||
duplicatesStrategy 'exclude'
|
||||
schemaZip.into(zipEntryName) {
|
||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||
from xsdFile.path
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ class SpringDependencyManagementConventionPlugin implements Plugin<Project> {
|
||||
|
||||
PluginManager pluginManager = project.getPluginManager()
|
||||
|
||||
pluginManager.apply(ManagementConfigurationPlugin)
|
||||
pluginManager.apply(DependencyManagementPlugin)
|
||||
|
||||
project.dependencyManagement {
|
||||
@@ -53,6 +52,7 @@ class SpringDependencyManagementConventionPlugin implements Plugin<Project> {
|
||||
applyDependencyManagementResources(project)
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private void applyDependencyManagementResources(Project project) {
|
||||
|
||||
File rootDir = project.rootDir
|
||||
|
||||
@@ -21,11 +21,13 @@ import org.gradle.api.plugins.PluginManager
|
||||
import org.springframework.gradle.maven.SpringMavenPlugin
|
||||
|
||||
/**
|
||||
* Defines a Gradle {@link Project} as a proper Spring module.
|
||||
* Defines a Gradle {@link Project} as a Spring module.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see io.spring.gradle.convention.AbstractSpringJavaPlugin
|
||||
* @see org.springframework.gradle.maven.SpringMavenPlugin
|
||||
* @see org.gradle.api.plugins.JavaLibraryPlugin
|
||||
* @see org.gradle.api.Project
|
||||
*/
|
||||
class SpringModulePlugin extends AbstractSpringJavaPlugin {
|
||||
@@ -37,8 +39,5 @@ class SpringModulePlugin extends AbstractSpringJavaPlugin {
|
||||
|
||||
pluginManager.apply(JavaLibraryPlugin.class)
|
||||
pluginManager.apply(SpringMavenPlugin.class);
|
||||
|
||||
// TODO: Why?
|
||||
Utils.configureDeployArtifactsTask(project)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package io.spring.gradle.convention;
|
||||
package io.spring.gradle.convention
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.sonarqube.gradle.SonarQubePlugin;
|
||||
import org.sonarqube.gradle.SonarQubePlugin
|
||||
|
||||
/**
|
||||
* Utility class encapsulating common operations on Gradle {@link Project Projects}.
|
||||
@@ -31,13 +31,13 @@ class Utils {
|
||||
|
||||
static String getProjectName(Project project) {
|
||||
|
||||
String projectName = project.getRootProject().getName();
|
||||
String projectName = project.getRootProject().getName()
|
||||
|
||||
if(projectName.endsWith("-build")) {
|
||||
projectName = projectName.substring(0, projectName.length() - "-build".length());
|
||||
if (projectName.endsWith("-build")) {
|
||||
projectName = projectName.substring(0, projectName.length() - "-build".length())
|
||||
}
|
||||
|
||||
return projectName;
|
||||
return projectName
|
||||
}
|
||||
|
||||
static boolean isMilestone(Project project) {
|
||||
@@ -54,23 +54,11 @@ class Utils {
|
||||
}
|
||||
|
||||
private static String projectVersion(Project project) {
|
||||
return String.valueOf(project.getVersion());
|
||||
}
|
||||
|
||||
static void configureDeployArtifactsTask(Project project) {
|
||||
|
||||
def deployArtifacts = project.task("deployArtifacts")
|
||||
|
||||
deployArtifacts.group = 'Deployments'
|
||||
deployArtifacts.description = "Deploys project artifacts to either Artifactory or Maven Central"
|
||||
|
||||
if (!isRelease(project)) {
|
||||
deployArtifacts.dependsOn project.tasks.artifactoryPublish
|
||||
}
|
||||
return String.valueOf(project.version)
|
||||
}
|
||||
|
||||
static String findPropertyAsString(Project project, String propertyName) {
|
||||
return (String) project.findProperty(propertyName);
|
||||
return (String) project.findProperty(propertyName)
|
||||
}
|
||||
|
||||
static void skipProjectWithSonarQubePlugin(Project project) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.gradle.api.Project;
|
||||
|
||||
/**
|
||||
* Copies {@literal root} {@link Project} properties to the target ({@literal this}) {@link Project},
|
||||
* the {@link Project} for which {@literal this} Gadle {@link Plugin} is applied.
|
||||
* the {@link Project} for which {@literal this} Gradle {@link Plugin} is applied.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
|
||||
@@ -36,6 +36,10 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.api.publish.PublishingExtension
|
||||
* @see org.gradle.api.publish.maven.MavenPom
|
||||
* @see org.gradle.api.publish.maven.MavenPublication
|
||||
* @see org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
*/
|
||||
public class MavenPublishingConventionsPlugin implements Plugin<Project> {
|
||||
|
||||
@@ -44,12 +48,12 @@ public class MavenPublishingConventionsPlugin implements Plugin<Project> {
|
||||
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(mavenPublishPlugin -> {
|
||||
|
||||
customizeJavaPlugin(project);
|
||||
|
||||
PublishingExtension publishingExtension = project.getExtensions().getByType(PublishingExtension.class);
|
||||
|
||||
publishingExtension.getPublications().withType(MavenPublication.class).all(mavenPublication ->
|
||||
customizeMavenPom(project, mavenPublication.getPom()));
|
||||
|
||||
customizeJavaPlugin(project);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.gradle.maven;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
@@ -25,28 +24,37 @@ import org.gradle.api.publish.maven.MavenPublication;
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
|
||||
/**
|
||||
* Adds the Java and JavaPlatform based projects to be published via Maven.
|
||||
* Adds Java and JavaPlatform based Gradle {@link Project Pojects} to be published by Maven.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.api.plugins.JavaPlatformPlugin
|
||||
* @see org.gradle.api.plugins.JavaPlugin
|
||||
* @see org.gradle.api.publish.PublishingExtension
|
||||
* @see org.gradle.api.publish.maven.MavenPublication
|
||||
* @see org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
*/
|
||||
public class PublishAllJavaComponentsPlugin implements Plugin<Project> {
|
||||
|
||||
private static final String JAVA_COMPONENT_NAME = "java";
|
||||
private static final String JAVA_PLATFORM_COMPONENT_NAME = "javaPlatform";
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(mavenPublish -> {
|
||||
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
PublishingExtension publishingExtension = project.getExtensions().getByType(PublishingExtension.class);
|
||||
|
||||
publishing.getPublications().create("mavenJava", MavenPublication.class, maven -> {
|
||||
project.getPlugins().withType(JavaPlugin.class,
|
||||
plugin -> maven.from(project.getComponents().getByName("java")));
|
||||
publishingExtension.getPublications().create("mavenJava", MavenPublication.class, mavenPublication -> {
|
||||
|
||||
project.getPlugins().withType(JavaPlatformPlugin.class,
|
||||
plugin -> maven.from(project.getComponents().getByName("javaPlatform")));
|
||||
project.getPlugins().withType(JavaPlugin.class, javaPlugin ->
|
||||
mavenPublication.from(project.getComponents().getByName(JAVA_COMPONENT_NAME)));
|
||||
|
||||
project.getPlugins().withType(JavaPlatformPlugin.class, javaPlatformPlugin ->
|
||||
mavenPublication.from(project.getComponents().getByName(JAVA_PLATFORM_COMPONENT_NAME)));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ import org.gradle.api.Project;
|
||||
import io.spring.gradle.convention.Utils;
|
||||
|
||||
/**
|
||||
* Publishes Gradle {@link Project} artifacts to either Artifactory (Spring Repositories) or Maven Central
|
||||
* through OSSRH.
|
||||
* Publishes Gradle {@link Project} artifacts to either Artifactory or Maven Central.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
@@ -36,17 +35,17 @@ public class PublishArtifactsPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
|
||||
project.getTasks().register("publishArtifacts", publishArtifacts -> {
|
||||
project.getTasks().register("publishArtifacts", publishArtifactsTask -> {
|
||||
|
||||
publishArtifacts.setGroup("Publishing");
|
||||
publishArtifacts.setDescription("Publish project artifacts to either Artifactory (Spring Repositories) "
|
||||
+ "or Maven Central based on the project version");
|
||||
publishArtifactsTask.setGroup("Publishing");
|
||||
publishArtifactsTask.setDescription("Publish project artifacts to either Artifactory or Maven Central"
|
||||
+ " based on the project version.");
|
||||
|
||||
if (Utils.isRelease(project)) {
|
||||
publishArtifacts.dependsOn("publishToOssrh");
|
||||
publishArtifactsTask.dependsOn("publishToOssrh");
|
||||
}
|
||||
else {
|
||||
publishArtifacts.dependsOn("artifactoryPublish");
|
||||
publishArtifactsTask.dependsOn("artifactoryPublish");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-present 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 org.springframework.gradle.maven;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.publish.PublishingExtension;
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
|
||||
/**
|
||||
* Adds configuration to publish Gradle {@link Project} artifacts to a {@literal local} Maven Repository,
|
||||
* rooted at {@literal projectDir/buildDir/publications/repos}.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
*/
|
||||
// TODO: Is this action even necessary??
|
||||
public class PublishLocalPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(mavenPublish -> {
|
||||
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
|
||||
publishing.getRepositories().maven(maven -> {
|
||||
maven.setName("local");
|
||||
maven.setUrl(new File(project.getRootProject().getBuildDir(), "publications/repos"));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,13 @@ import org.gradle.api.plugins.PluginManager;
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
|
||||
/**
|
||||
* Declares and enables Maven functionality for a Spring Gradle {@link Project Projects}.
|
||||
* Enables publishing to Maven for a Spring module Gradle {@link Project}.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
*/
|
||||
public class SpringMavenPlugin implements Plugin<Project> {
|
||||
|
||||
@@ -40,7 +41,6 @@ public class SpringMavenPlugin implements Plugin<Project> {
|
||||
pluginManager.apply(MavenPublishingConventionsPlugin.class);
|
||||
pluginManager.apply(PublishAllJavaComponentsPlugin.class);
|
||||
pluginManager.apply(PublishArtifactsPlugin.class);
|
||||
pluginManager.apply(PublishLocalPlugin.class);
|
||||
pluginManager.apply(SpringSigningPlugin.class);
|
||||
pluginManager.apply(ArtifactoryPlugin.class);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.github.gradlenexus.publishplugin.NexusPublishExtension;
|
||||
import io.github.gradlenexus.publishplugin.NexusPublishPlugin;
|
||||
|
||||
/**
|
||||
* Enables a Gradle {@link Project} to publish to Maven Central through OSSRH using Sonatype's Nexus Repository Manager.
|
||||
* Enables a Gradle {@link Project} to publish to Maven Central using Sonatype's Nexus Repository Manager.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
@@ -33,27 +33,29 @@ import io.github.gradlenexus.publishplugin.NexusPublishPlugin;
|
||||
*/
|
||||
public class SpringNexusPublishPlugin implements Plugin<Project> {
|
||||
|
||||
private static final String SONATYPE_NEXUS_URL = "https://s01.oss.sonatype.org/service/local/";
|
||||
private static final String SONATYPE_SNAPSHOT_REPOSITORY_URL = "https://s01.oss.sonatype.org/content/repositories/snapshots/";
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
|
||||
project.getPlugins().apply(NexusPublishPlugin.class);
|
||||
|
||||
NexusPublishExtension nexusPublishing = project.getExtensions().findByType(NexusPublishExtension.class);
|
||||
NexusPublishExtension nexusPublishExtension = project.getExtensions().findByType(NexusPublishExtension.class);
|
||||
|
||||
// TODO: Why did we not simply use/configure the 'sonatype' repository and instead add a repo ('ossrh')?
|
||||
// See here: https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
|
||||
// NOTE: Careful, the keyword 'ossrh' is refered to in names in the Spring Build Conventions Gradle Plugins,
|
||||
// NOTE: Careful, the keyword 'ossrh' is referred to in names in the Spring Build Conventions Gradle Plugins,
|
||||
// such as, but not limited to:
|
||||
// * 'ossrhUsername'
|
||||
// * 'publishToOssrh'
|
||||
// * 'closeAndReleaseOssrhStagingRepository'
|
||||
nexusPublishing.getRepositories().create("ossrh", nexusRepository -> {
|
||||
nexusRepository.getNexusUrl().set(URI.create("https://s01.oss.sonatype.org/service/local/"));
|
||||
nexusRepository.getSnapshotRepositoryUrl()
|
||||
.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"));
|
||||
nexusPublishExtension.getRepositories().create("ossrh", nexusRepository -> {
|
||||
nexusRepository.getNexusUrl().set(URI.create(SONATYPE_NEXUS_URL));
|
||||
nexusRepository.getSnapshotRepositoryUrl().set(URI.create(SONATYPE_SNAPSHOT_REPOSITORY_URL));
|
||||
});
|
||||
|
||||
nexusPublishing.getClientTimeout().set(Duration.ofMinutes(3));
|
||||
nexusPublishing.getConnectTimeout().set(Duration.ofMinutes(3));
|
||||
nexusPublishExtension.getClientTimeout().set(Duration.ofMinutes(3));
|
||||
nexusPublishExtension.getConnectTimeout().set(Duration.ofMinutes(3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,20 +63,20 @@ public class SpringSigningPlugin implements Plugin<Project> {
|
||||
|
||||
private void sign(Project project) {
|
||||
|
||||
SigningExtension signing = resolveAndConfigureSigningExtension(project);
|
||||
SigningExtension signing = findAndConfigureSigningExtension(project);
|
||||
|
||||
project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(publishingPlugin -> {
|
||||
project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(publishJavaComponentsPlugin -> {
|
||||
PublishingExtension publishing = project.getExtensions().findByType(PublishingExtension.class);
|
||||
Publication maven = publishing.getPublications().getByName("mavenJava");
|
||||
signing.sign(maven);
|
||||
});
|
||||
}
|
||||
|
||||
private SigningExtension resolveAndConfigureSigningExtension(Project project) {
|
||||
private SigningExtension findAndConfigureSigningExtension(Project project) {
|
||||
|
||||
SigningExtension signing = project.getExtensions().findByType(SigningExtension.class);
|
||||
SigningExtension signingExtension = project.getExtensions().findByType(SigningExtension.class);
|
||||
|
||||
return configurePgpKeys(project, configureSigningRequired(project, signing));
|
||||
return configurePgpKeys(project, configureSigningRequired(project, signingExtension));
|
||||
}
|
||||
|
||||
private SigningExtension configureSigningRequired(Project project, SigningExtension signing) {
|
||||
|
||||
@@ -13,31 +13,33 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.gradle.propdeps
|
||||
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.plugins.ide.eclipse.EclipsePlugin
|
||||
|
||||
/**
|
||||
* Plugin to allow optional and provided dependency configurations to work with the
|
||||
* standard gradle 'eclipse' plugin
|
||||
* Gradle {@link Plugin} to allow {@literal optional} and {@literal provided} dependency configurations
|
||||
* to work with the standard Gradle {@link EclipsePlugin}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.plugins.ide.eclipse.EclipsePlugin
|
||||
*/
|
||||
class PropDepsEclipsePlugin implements Plugin<Project> {
|
||||
|
||||
public void apply(Project project) {
|
||||
void apply(Project project) {
|
||||
|
||||
project.plugins.apply(PropDepsPlugin)
|
||||
project.plugins.apply(EclipsePlugin)
|
||||
|
||||
project.eclipse {
|
||||
classpath {
|
||||
plusConfigurations += [project.configurations.provided, project.configurations.optional]
|
||||
plusConfigurations += [ project.configurations.provided, project.configurations.optional ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2022-present 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.
|
||||
@@ -13,34 +13,36 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.gradle.propdeps
|
||||
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.plugins.ide.idea.IdeaPlugin
|
||||
|
||||
/**
|
||||
* Plugin to allow optional and provided dependency configurations to work with the
|
||||
* standard gradle 'idea' plugin
|
||||
* Gradle {@link Plugin} to allow {@literal optional} and {@literal provided} dependency configurations
|
||||
* to work with the standard Gradle {@link IdeaPlugin}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Brian Clozel
|
||||
* @author John Blum
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.gradle.plugins.ide.idea.IdeaPlugin
|
||||
* @link https://youtrack.jetbrains.com/issue/IDEA-107046
|
||||
* @link https://youtrack.jetbrains.com/issue/IDEA-117668
|
||||
*/
|
||||
class PropDepsIdeaPlugin implements Plugin<Project> {
|
||||
|
||||
public void apply(Project project) {
|
||||
void apply(Project project) {
|
||||
|
||||
project.plugins.apply(PropDepsPlugin)
|
||||
project.plugins.apply(IdeaPlugin)
|
||||
project.idea.module {
|
||||
// IDEA internally deals with 4 scopes : COMPILE, TEST, PROVIDED, RUNTIME
|
||||
// IntelliJ IDEA internally deals with 4 scopes : COMPILE, TEST, PROVIDED, RUNTIME
|
||||
// but only PROVIDED seems to be picked up
|
||||
scopes.PROVIDED.plus += [project.configurations.provided]
|
||||
scopes.PROVIDED.plus += [project.configurations.optional]
|
||||
scopes.PROVIDED.plus += [ project.configurations.provided ]
|
||||
scopes.PROVIDED.plus += [ project.configurations.optional ]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2022-present 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.
|
||||
@@ -13,10 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.gradle.propdeps
|
||||
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
@@ -25,12 +23,13 @@ import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
|
||||
/**
|
||||
* Plugin to allow 'optional' and 'provided' dependency configurations
|
||||
* Gradle {@link Plugin} to allow {@literal optional} and {@literal provided} dependency configurations.
|
||||
*
|
||||
* As stated in the maven documentation, provided scope "is only available on the compilation and test classpath,
|
||||
* and is not transitive".
|
||||
* As stated in the Maven documentation, {@literal provided} scope {@literal "is only available on the compilation
|
||||
* and test classpath, and is not transitive"}.
|
||||
*
|
||||
* This {@link Plugin} creates two new configurations, and each one:
|
||||
*
|
||||
* This plugin creates two new configurations, and each one:
|
||||
* <ul>
|
||||
* <li>is a parent of the compile configuration</li>
|
||||
* <li>is not visible, not transitive</li>
|
||||
@@ -40,27 +39,35 @@ import org.gradle.api.tasks.javadoc.Javadoc
|
||||
* @author Phillip Webb
|
||||
* @author Brian Clozel
|
||||
* @author Rob Winch
|
||||
* @author John Blum
|
||||
*
|
||||
* @see org.gradle.api.Plugin
|
||||
* @see org.gradle.api.Project
|
||||
* @see org.springframework.gradle.propdeps.PropDepsEclipsePlugin
|
||||
* @see org.springframework.gradle.propdeps.PropDepsIdeaPlugin
|
||||
* @see <a href="https://www.gradle.org/docs/current/userguide/java_plugin.html#N121CF">Maven documentation</a>
|
||||
* @see <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope">Gradle configurations</a>
|
||||
* @see PropDepsEclipsePlugin
|
||||
* @see PropDepsIdeaPlugin
|
||||
*/
|
||||
class PropDepsPlugin implements Plugin<Project> {
|
||||
|
||||
public void apply(Project project) {
|
||||
void apply(Project project) {
|
||||
|
||||
project.plugins.apply(JavaPlugin)
|
||||
|
||||
Configuration provided = addConfiguration(project, "provided")
|
||||
Configuration optional = addConfiguration(project, "optional")
|
||||
Configuration provided = addConfiguration(project, "provided")
|
||||
|
||||
Javadoc javadoc = project.tasks.getByName(JavaPlugin.JAVADOC_TASK_NAME)
|
||||
javadoc.classpath = javadoc.classpath.plus(provided).plus(optional)
|
||||
|
||||
javadoc.classpath = javadoc.classpath + provided + optional
|
||||
}
|
||||
|
||||
private Configuration addConfiguration(Project project, String name) {
|
||||
|
||||
Configuration configuration = project.configurations.create(name)
|
||||
|
||||
configuration.extendsFrom(project.configurations.implementation)
|
||||
|
||||
project.plugins.withType(JavaLibraryPlugin, {
|
||||
configuration.extendsFrom(project.configurations.api)
|
||||
})
|
||||
@@ -72,5 +79,4 @@ class PropDepsPlugin implements Plugin<Project> {
|
||||
|
||||
return configuration
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ echo "Deploying artifacts on host [$HOSTNAME]"
|
||||
chown -R 1001:1001 .
|
||||
|
||||
GRADLE_OPTS="-Duser.name=jenkins -Djava.io.tmpdir=/tmp -Dgradle.user.home=/tmp/geode/boot/artifacts-gradle-cache" \
|
||||
./gradlew deployArtifacts finalizeDeployArtifacts --no-build-cache --no-configuration-cache --no-daemon --stacktrace \
|
||||
./gradlew publishArtifacts releasePublishedArtifacts --no-build-cache --no-configuration-cache --no-daemon --stacktrace \
|
||||
-PartifactoryUsername=$ARTIFACTORY_USERNAME \
|
||||
-PartifactoryPassword=$ARTIFACTORY_PASSWORD \
|
||||
-PossrhUsername=$OSSRH_USERNAME \
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
deployDocsHost=docs-ip.spring.io
|
||||
antlrVersion=2.7.7
|
||||
apacheGeodeVersion=1.14.3
|
||||
awaitilityVersion=4.1.1
|
||||
|
||||
Reference in New Issue
Block a user