-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle
186 lines (163 loc) · 6.01 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository
import org.springframework.boot.gradle.tasks.bundling.BootJar
buildscript {
repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
}
}
group = 'org.grails.plugins'
version = projectVersion
apply plugin: 'groovy'
apply plugin: 'java-library'
apply plugin: 'jvm-test-suite'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
}
configurations {
documentation
}
// FORCE UPGRADE OF GROOVY IN DEPENDENCIES TO GROOVY 4
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion)
}
}
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
withJavadocJar()
}
dependencies {
api 'org.grails:grails-web-common'
implementation "org.apache.commons:commons-lang3:$commonsLang3Version"
implementation "org.codehaus.groovy:groovy-xml:$groovyVersion"
implementation 'org.grails:grails-bootstrap'
implementation "org.grails:grails-datastore-gorm:$datastoreVersion"
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion" // Provided
testImplementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
testImplementation 'org.grails:grails-core'
testImplementation 'org.grails:grails-datastore-core'
testImplementation 'org.grails:grails-web-common'
testImplementation "org.springframework:spring-context:$springVersion"
testImplementation "org.spockframework:spock-core:$spockVersion"
documentation 'com.github.javaparser:javaparser-core:3.26.1'
}
tasks.named('groovydoc', Groovydoc) {
classpath += configurations.documentation
}
tasks.named('bootJar', BootJar) {
enabled = false
mainClass = 'grails.plugin.converters.Application'
}
tasks.named('jar', Jar) {
enabled = true
archiveClassifier = ''
}
testing {
suites {
test {
useJUnitJupiter()
targets.configureEach {
testTask.configure { Test task ->
task.testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
}
}
}
ext.set('signing.keyId', System.getenv('SIGNING_KEY'))
ext.set('signing.password', System.getenv('SIGNING_PASSPHRASE'))
ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT'))
ext.set('isReleaseVersion', !isSnapshot)
def javaComponent = components.named('java')
publishing {
publications {
register('mavenJava', MavenPublication) {
from javaComponent.get()
versionMapping {
usage('java-api') { fromResolutionOf('runtimeClasspath') }
usage('java-runtime') { fromResolutionResult() }
}
pom {
name = 'Grails Converters Plugin'
description = 'Provides JSON and XML converters'
url = 'https://github.com/grails-plugins/grails-plugin-converters'
licenses {
license {
name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
connection = 'scm:git:git://github.com/grails-plugins/grails-plugin-converters.git'
developerConnection = 'scm:git:ssh://github.com/grails-plugins/grails-plugin-converters.git'
url = 'https://github.com/grails-plugins/grails-plugin-converters'
}
developers {
developer {
id = 'graemerocher'
name = 'Graeme Rocher'
}
}
}
// dependency management shouldn't be included
pom.withXml {
def root = it.asElement()
root.getElementsByTagName('dependencyManagement').each { root.removeChild(it) }
}
}
}
if (isSnapshot) {
repositories {
maven {
credentials {
username = project.findProperty('artifactoryUsername') ?: ''
password = project.findProperty('artifactoryPassword') ?: ''
}
url = uri('https://repo.grails.org/grails/plugins3-snapshots-local')
}
}
}
}
def mavenPublication = publishing.publications.named('mavenJava')
afterEvaluate {
signing {
required = { isReleaseVersion }
sign mavenPublication.get()
}
}
//do not generate extra load on Nexus with new staging repository if signing fails
tasks.withType(InitializeNexusStagingRepository).configureEach {
shouldRunAfter = tasks.withType(Sign)
}
if (isReleaseVersion && project.hasProperty('release')) {
nexusPublishing {
String sonatypeUsername = project.findProperty('sonatypeOssUsername') ?: ''
String sonatypePassword = project.findProperty('sonatypeOssPassword') ?: ''
String sonatypeStagingProfileId = project.findProperty('sonatypeOssStagingProfileId') ?: ''
String sonatypeOssRepository = project.findProperty('sonatypeOssRepo') ?: ''
repositories {
sonatype {
nexusUrl = uri(sonatypeOssRepository)
username = sonatypeUsername
password = sonatypePassword
stagingProfileId = sonatypeStagingProfileId
}
}
}
}