Refactor Gradle build
This commit refactors the Gradle build with the following: * use of the dependency management plugin * import the Spring Boot BOM for dependency management * add support for publishing artifacts
This commit is contained in:
76
build.gradle
76
build.gradle
@@ -1,54 +1,40 @@
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '2.3.3.RELEASE' apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
apply plugin: 'maven'
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
group = 'org.springframework.experimental'
|
||||
version = "0.1.0-SNAPSHOT"
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
version = "0.1"
|
||||
group = 'org.springframework'
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
|
||||
}
|
||||
dependencies {
|
||||
dependency 'com.graphql-java:graphql-java:15.0'
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
graphqlJavaVersion = "15.0"
|
||||
springVersion = "5.2.8.RELEASE"
|
||||
springBootVersion = "2.3.2.RELEASE"
|
||||
jacksonVersion = "2.9.8"
|
||||
assertJVersion = "3.16.1"
|
||||
}
|
||||
dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
dependsOn classes
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/gradle/publishing.gradle"
|
||||
}
|
||||
|
||||
task myWrapper(type: Wrapper) {
|
||||
gradleVersion = '6.5.1'
|
||||
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
|
||||
}
|
||||
|
||||
|
||||
104
gradle/publishing.gradle
Normal file
104
gradle/publishing.gradle
Normal file
@@ -0,0 +1,104 @@
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
javadoc {
|
||||
description = "Generates project-level javadoc for use in -javadoc jar"
|
||||
|
||||
options.encoding = "UTF-8"
|
||||
options.memberLevel = JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = project.name
|
||||
options.use = true
|
||||
options.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
|
||||
}
|
||||
|
||||
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-experimental/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-experimental/spring-graphql"
|
||||
connection = "scm:git:git://github.com/spring-projects-experimental/spring-graphql"
|
||||
developerConnection = "scm:git:git://github.com/spring-projects-experimental/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-experimental/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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
description = "GraphQL Java Spring Boot starter Webmvc"
|
||||
description = "Starter for building GraphQL Java applications with Spring WebFlux"
|
||||
|
||||
dependencies {
|
||||
implementation "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
|
||||
implementation project(':spring-graphql-webflux')
|
||||
implementation 'org.springframework.boot:spring-boot-autoconfigure'
|
||||
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
|
||||
testCompile "org.springframework.boot:spring-boot-starter-webflux:$springBootVersion"
|
||||
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-webflux'
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
description = "GraphQL Java Spring Boot starter Webmvc"
|
||||
dependencies {
|
||||
implementation "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
|
||||
implementation project(':spring-graphql-webmvc')
|
||||
description = "Starter for building GraphQL Java applications with Spring WebFlux"
|
||||
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
|
||||
testCompile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
|
||||
dependencies {
|
||||
implementation project(':spring-graphql-webmvc')
|
||||
implementation 'org.springframework.boot:spring-boot-autoconfigure'
|
||||
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-web'
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
description = "GraphQL Java Spring Common"
|
||||
|
||||
apply plugin: 'java-library'
|
||||
description = "Common module for GraphQL Java Spring support"
|
||||
|
||||
dependencies {
|
||||
implementation "org.springframework:spring-web:$springVersion"
|
||||
api 'io.projectreactor:reactor-core:3.3.8.RELEASE'
|
||||
api "com.graphql-java:graphql-java:$graphqlJavaVersion"
|
||||
|
||||
testImplementation("org.assertj:assertj-core:$assertJVersion")
|
||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||
testImplementation "org.springframework:spring-test:$springVersion"
|
||||
testImplementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
|
||||
testImplementation "org.mockito:mockito-core:2.+"
|
||||
api 'io.projectreactor:reactor-core'
|
||||
api "com.graphql-java:graphql-java"
|
||||
implementation "org.springframework:spring-web"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
description = "GraphQL Java Spring Webmvc integration"
|
||||
|
||||
apply plugin: 'java-library'
|
||||
description = "GraphQL Java Spring WebFlux integration"
|
||||
|
||||
dependencies {
|
||||
implementation "org.springframework:spring-webflux:$springVersion"
|
||||
implementation "org.springframework:spring-context:$springVersion"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
|
||||
api "com.graphql-java:graphql-java:$graphqlJavaVersion"
|
||||
implementation project(':spring-graphql-common')
|
||||
api 'com.graphql-java:graphql-java'
|
||||
|
||||
testImplementation("org.assertj:assertj-core:$assertJVersion")
|
||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||
testImplementation "org.springframework:spring-test:$springVersion"
|
||||
testImplementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
|
||||
testImplementation "org.mockito:mockito-core:2.+"
|
||||
implementation project(':spring-graphql-common')
|
||||
implementation 'org.springframework:spring-context'
|
||||
implementation 'org.springframework:spring-webflux'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
||||
}
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
description = "GraphQL Java Spring Webmvc integration"
|
||||
|
||||
apply plugin: 'java-library'
|
||||
description = "GraphQL Java Spring MVC integration"
|
||||
|
||||
dependencies {
|
||||
implementation "org.springframework:spring-webmvc:$springVersion"
|
||||
implementation "org.springframework:spring-context:$springVersion"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
|
||||
api "com.graphql-java:graphql-java:$graphqlJavaVersion"
|
||||
implementation project(':spring-graphql-common')
|
||||
implementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
|
||||
api 'com.graphql-java:graphql-java'
|
||||
|
||||
testImplementation("org.assertj:assertj-core:$assertJVersion")
|
||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||
testImplementation "org.springframework:spring-test:$springVersion"
|
||||
testImplementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
|
||||
testImplementation "org.mockito:mockito-core:2.+"
|
||||
implementation project(':spring-graphql-common')
|
||||
implementation 'org.springframework:spring-webmvc'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
||||
implementation 'javax.servlet:javax.servlet-api'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user