Skip to content

Commit a2fa240

Browse files
committed
Remove Maven support
Closes gh-25
1 parent 65e0881 commit a2fa240

File tree

40 files changed

+520
-2489
lines changed

40 files changed

+520
-2489
lines changed

README.md

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gradle Enterprise Conventions
22

3-
Conventions for Maven and Gradle projects that use the Gradle Enterprise instance hosted at [ge.spring.io](https://ge.spring.io).
3+
Conventions for Gradle projects that use the Gradle Enterprise instance hosted at [ge.spring.io](https://ge.spring.io).
44

55
## Build cache conventions
66

@@ -96,8 +96,6 @@ Jenkins is detected by looking for an environment variable named `JENKINS_URL`.
9696
The conventions are published to https://repo.spring.io.
9797
Depending on the version you wish to use, they will be availble from the `snapshot` or `release` repository.
9898

99-
### Gradle
100-
10199
The first step in using the conventions is to make the necessary repository available for plugin resolution.
102100
This is done by configuring a plugin management repository in `settings.gradle`, as shown in the following example:
103101

@@ -137,23 +135,4 @@ plugins {
137135
id "io.spring.ge.conventions" version "<<version>>"
138136
// …
139137
}
140-
```
141-
142-
### Maven
143-
144-
To use the conventions, configure both the Gradle Enterprise and the Conventions Maven extensions in `.mvn/extensions.xml`, as showing in the following example:
145-
146-
```xml
147-
<extensions>
148-
<extension>
149-
<groupId>com.gradle</groupId>
150-
<artifactId>gradle-enterprise-maven-extension</artifactId>
151-
<version><<version>></version>
152-
</extension>
153-
<extension>
154-
<groupId>io.spring.ge.conventions</groupId>
155-
<artifactId>gradle-enterprise-conventions-maven-extension</artifactId>
156-
<version><<version>></version>
157-
</extension>
158-
</extensions>
159138
```

build.gradle

+112-65
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,124 @@
1-
allprojects {
2-
group = 'io.spring.ge.conventions'
1+
plugins {
2+
id "checkstyle"
3+
id "io.spring.javaformat" version "$javaFormatVersion"
4+
id "java-gradle-plugin"
5+
id "maven-publish"
6+
id "io.spring.compatibility-test"
37
}
48

5-
subprojects {
6-
plugins.withType(JavaPlugin) {
7-
sourceCompatibility = 1.8
8-
targetCompatibility = 1.8
9-
dependencies {
10-
testImplementation("org.assertj:assertj-core:3.11.1")
11-
testImplementation("org.junit.jupiter:junit-jupiter:5.6.0")
12-
testImplementation("org.mockito:mockito-core:3.2.4")
13-
}
14-
tasks.withType(Test).all {
15-
useJUnitPlatform()
16-
}
17-
java {
18-
withJavadocJar()
19-
withSourcesJar()
9+
description = "Gradle Enterprise Conventions Gradle plugin"
10+
group = 'io.spring.ge.conventions'
11+
12+
sourceCompatibility = 1.8
13+
targetCompatibility = 1.8
14+
15+
repositories {
16+
mavenCentral()
17+
gradlePluginPortal()
18+
}
19+
20+
configurations {
21+
compatibilityTestImplementation
22+
}
23+
24+
dependencies {
25+
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
26+
27+
compileOnly("com.gradle:gradle-enterprise-gradle-plugin:${gradleEnterprisePluginVersion}")
28+
29+
testImplementation("com.gradle:gradle-enterprise-gradle-plugin:${gradleEnterprisePluginVersion}")
30+
testImplementation("org.assertj:assertj-core:3.11.1")
31+
testImplementation("org.junit.jupiter:junit-jupiter:5.6.0")
32+
testImplementation("org.mockito:mockito-core:3.2.4")
33+
}
34+
35+
gradlePlugin {
36+
plugins {
37+
gradleEnterprisePlugin {
38+
displayName = project.description
39+
description = project.description
40+
id = 'io.spring.ge.conventions'
41+
implementationClass = 'io.spring.ge.conventions.gradle.GradleEnterpriseConventionsPlugin'
2042
}
2143
}
22-
plugins.withType(CheckstylePlugin) {
23-
dependencies {
24-
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
25-
}
26-
checkstyle {
27-
def archive = configurations.checkstyle.filter { it.name.startsWith("spring-javaformat-checkstyle")}
28-
config = resources.text.fromArchiveEntry(archive, "io/spring/javaformat/checkstyle/checkstyle.xml")
29-
toolVersion = 8.28
44+
}
45+
46+
compatibilityTest {
47+
useJUnitPlatform()
48+
dependency('Gradle Enterprise Plugin') { gePlugin ->
49+
gePlugin.groupId = 'com.gradle'
50+
gePlugin.artifactId = 'gradle-enterprise-gradle-plugin'
51+
gePlugin.versions = [
52+
'3.1.1', '3.2.1', '3.3.4', '3.4.1', '3.5.2'
53+
]
54+
}
55+
}
56+
57+
tasks.withType(Test) { testTask ->
58+
if (testTask.name.startsWith("compatibilityTest_")) {
59+
testTask.filter {
60+
includeTestsMatching "*IntegrationTests"
3061
}
3162
}
32-
plugins.withType(MavenPublishPlugin) {
33-
tasks.withType(GenerateModuleMetadata).all {
34-
enabled = false
63+
}
64+
65+
test {
66+
useJUnitPlatform()
67+
}
68+
69+
java {
70+
withJavadocJar()
71+
withSourcesJar()
72+
}
73+
74+
checkstyle {
75+
def archive = configurations.checkstyle.filter { it.name.startsWith("spring-javaformat-checkstyle")}
76+
config = resources.text.fromArchiveEntry(archive, "io/spring/javaformat/checkstyle/checkstyle.xml")
77+
toolVersion = 8.28
78+
}
79+
80+
tasks.withType(GenerateModuleMetadata).all {
81+
enabled = false
82+
}
83+
84+
if (project.hasProperty("distributionRepository")) {
85+
publishing {
86+
repositories {
87+
maven {
88+
url = "${distributionRepository}"
89+
name = "deployment"
90+
}
3591
}
36-
if (project.hasProperty("distributionRepository")) {
37-
publishing {
38-
repositories {
39-
maven {
40-
url = "${distributionRepository}"
41-
name = "deployment"
92+
}
93+
}
94+
95+
publishing {
96+
publications {
97+
withType(MavenPublication) { mavenPublication ->
98+
pom {
99+
name = project.description
100+
description = project.description
101+
url = 'https://github.com/spring-io/gradle-enterprise-conventions'
102+
organization {
103+
name = 'Pivotal Software, Inc.'
104+
url = 'https://spring.io'
105+
}
106+
licenses {
107+
license {
108+
name = 'The Apache Software License, Version 2.0'
109+
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
42110
}
43111
}
44-
}
45-
}
46-
publishing {
47-
publications {
48-
withType(MavenPublication) { mavenPublication ->
49-
pom {
50-
name = project.description
51-
description = project.description
52-
url = 'https://github.com/spring-io/gradle-enterprise-conventions'
53-
organization {
54-
name = 'Pivotal Software, Inc.'
55-
url = 'https://spring.io'
56-
}
57-
licenses {
58-
license {
59-
name = 'The Apache Software License, Version 2.0'
60-
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
61-
}
62-
}
63-
scm {
64-
url = 'https://github.com/spring-io/gradle-enterprise-conventions'
65-
connection = 'scm:git:https://github.com/spring-io/gradle-enterprise-conventions'
66-
}
67-
developers {
68-
developer {
69-
id = 'wilkinsona'
70-
name = 'Andy Wilkinson'
71-
72-
roles = ["Project lead"]
73-
}
74-
}
112+
scm {
113+
url = 'https://github.com/spring-io/gradle-enterprise-conventions'
114+
connection = 'scm:git:https://github.com/spring-io/gradle-enterprise-conventions'
115+
}
116+
developers {
117+
developer {
118+
id = 'wilkinsona'
119+
name = 'Andy Wilkinson'
120+
121+
roles = ["Project lead"]
75122
}
76123
}
77124
}

ci/parameters.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ github-repo-name: "spring-io/gradle-enterprise-conventions"
33
docker-hub-organization: "springci"
44
artifactory-server: "https://repo.spring.io"
55
branch: "main"
6-
build-name: "gradle-enterprise-conventions"
7-
bintray-subject: "spring"
8-
bintray-repo: "jars"
6+
build-name: "gradle-enterprise-conventions"

ci/pipeline.yml

+1-26
Original file line numberDiff line numberDiff line change
@@ -106,31 +106,6 @@ jobs:
106106
ARTIFACTORY_SERVER: ((artifactory-server))
107107
ARTIFACTORY_USERNAME: ((artifactory-username))
108108
ARTIFACTORY_PASSWORD: ((artifactory-password))
109-
BINTRAY_SUBJECT: ((bintray-subject))
110-
BINTRAY_REPO: ((bintray-repo))
111-
BINTRAY_USERNAME: ((bintray-username))
112-
BINTRAY_API_KEY: ((bintray-api-key))
113-
- name: sync-to-maven-central
114-
serial: true
115-
plan:
116-
- get: ci-image
117-
- get: git-repo
118-
- get: artifactory-repo
119-
trigger: true
120-
passed: [promote-release]
121-
params:
122-
download_artifacts: false
123-
save_build_info: true
124-
- task: sync-to-maven-central
125-
image: ci-image
126-
file: git-repo/ci/tasks/sync-to-maven-central.yml
127-
params:
128-
BINTRAY_SUBJECT: ((bintray-subject))
129-
BINTRAY_REPO: ((bintray-repo))
130-
BINTRAY_USERNAME: ((bintray-username))
131-
BINTRAY_API_KEY: ((bintray-api-key))
132-
SONATYPE_USER_TOKEN: ((sonatype-user-token))
133-
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
134109
- task: generate-release-notes
135110
file: git-repo/ci/tasks/generate-release-notes.yml
136111
params:
@@ -146,6 +121,6 @@ groups:
146121
- name: "build"
147122
jobs: ["build"]
148123
- name: "release"
149-
jobs: ["stage-release", "promote-release", "sync-to-maven-central"]
124+
jobs: ["stage-release", "promote-release"]
150125
- name: "ci-image"
151126
jobs: ["build-ci-image"]

ci/scripts/promote.sh

-37
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,5 @@ curl \
3535
fi
3636
}
3737

38-
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
39-
curl \
40-
-s \
41-
--connect-timeout 240 \
42-
--max-time 2700 \
43-
-u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \
44-
-H "Content-type:application/json" \
45-
-d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \
46-
-f \
47-
-X \
48-
POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; }
49-
50-
echo "Waiting for artifacts to be published"
51-
52-
WAIT_TIME=20
53-
WAIT_ATTEMPTS=120
54-
55-
artifacts_published=false
56-
retry_counter=0
57-
while [ $artifacts_published == "false" ] && [ $retry_counter -lt $WAIT_ATTEMPTS ]; do
58-
result=$( curl -s -f -u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" )
59-
if [ $? -eq 0 ]; then
60-
versions=$( echo "$result" | jq -r '.versions' )
61-
exists=$( echo "$versions" | grep "$version" -o || true )
62-
if [ "$exists" = "$version" ]; then
63-
artifacts_published=true
64-
fi
65-
fi
66-
retry_counter=$(( retry_counter + 1 ))
67-
sleep $WAIT_TIME
68-
done
69-
if [[ $artifacts_published = "false" ]]; then
70-
echo "Failed to publish"
71-
exit 1
72-
fi
73-
fi
74-
7538
echo "Promotion complete"
7639
echo $version > version/version

ci/scripts/sync-to-maven-central.sh

-33
This file was deleted.

ci/tasks/sync-to-maven-central.yml

-16
This file was deleted.

gradle-enterprise-conventions-core/build.gradle

-20
This file was deleted.

0 commit comments

Comments
 (0)