Files
spring-graphql/gradle/publishing.gradle
Brian Clozel e268157909 Add MANIFEST entries in published Jars
Closes gh-391
2022-05-18 12:04:46 +02:00

119 lines
3.1 KiB
Groovy

apply plugin: "maven-publish"
plugins.withType(JavaPlugin) {
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options {
encoding = "UTF-8"
memberLevel = JavadocMemberLevel.PROTECTED
author = true
header = project.name
use = true
links = project.ext.javadocLinks
addStringOption("Xdoclint:none", "-quiet")
}
// Suppress warnings due to cross-module @see and @link references.
// Note that global 'api' task does display all warnings.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
}
jar {
manifest.attributes["Implementation-Title"] = project.name
manifest.attributes["Implementation-Version"] = project.version
manifest.attributes["Automatic-Module-Name"] = project.name.replace('-', '.') // for Jigsaw
manifest.attributes["Created-By"] =
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
}
task sourcesJar(type: Jar, dependsOn: classes) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier.set("javadoc")
from javadoc
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
afterEvaluate {
name = project.description
description = project.description
}
url = "https://github.com/spring-projects/spring-graphql"
organization {
name = "Spring IO"
url = "https://spring.io/projects"
}
licenses {
license {
name = "Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
scm {
url = "https://github.com/spring-projects/spring-graphql"
connection = "scm:git:git://github.com/spring-projects/spring-graphql"
developerConnection = "scm:git:git://github.com/spring-projects/spring-graphql"
}
developers {
developer {
id = "andimarek"
name = "Andreas Marek"
email = "andimarek@fastmail.fm"
}
developer {
id = "rstoyanchev"
name = "Rossen Stoyanchev"
email = "rstoyanchev@vmware.com"
}
developer {
id = "bclozel"
name = "Brian Clozel"
email = "bclozel@vmware.com"
}
}
issueManagement {
system = "GitHub"
url = "https://github.com/spring-projects/spring-graphql/issues"
}
}
versionMapping {
usage('java-api') {
fromResolutionResult()
}
usage('java-runtime') {
fromResolutionResult()
}
}
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
}
configureDeploymentRepository(project)
void configureDeploymentRepository(Project project) {
project.plugins.withType(MavenPublishPlugin.class).all {
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
if (project.hasProperty("deploymentRepository")) {
publishing.repositories.maven {
it.url = project.property("deploymentRepository")
it.name = "deployment"
}
}
}
}