Skip to content

Commit 9751123

Browse files
feat build.gradle: update maven repositories for improved security and reliability
- Switch from jcenter to mavenCentral as the primary repository - Enable plugins Gradle repository to use https://plugins.gradle.org/m2/ for plugin downloads - Update Maven Central URLs for release and snapshot repositories - Securely authenticate with Sonatype using environment variables
1 parent 6367fdf commit 9751123

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

build.gradle

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ allprojects {
1313
apply plugin: 'jacoco'
1414

1515
repositories {
16-
jcenter()
16+
mavenCentral()
17+
maven {
18+
url 'https://plugins.gradle.org/m2/'
19+
}
1720
}
1821

1922
jacoco {
@@ -47,12 +50,12 @@ configure(publishedProjects) {
4750
sourceCompatibility = 1.8
4851
targetCompatibility = 1.8
4952

50-
repositories {
51-
jcenter()
52-
maven {
53-
url 'https://plugins.gradle.org/m2/'
54-
}
55-
}
53+
// repositories {
54+
// // jcenter()
55+
// maven {
56+
// url 'https://plugins.gradle.org/m2/'
57+
// }
58+
// }
5659

5760
task sourcesJar(type: Jar, dependsOn: classes) {
5861
archiveClassifier.set('sources')
@@ -139,8 +142,8 @@ configure(publishedProjects) {
139142
}
140143
repositories {
141144
maven {
142-
def releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
143-
def snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots"
145+
def releaseUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
146+
def snapshotUrl = "https://central.sonatype.com/repository/maven-snapshots/"
144147
url = isReleaseVersion ? releaseUrl : snapshotUrl
145148
credentials {
146149
username System.getenv('MAVEN_CENTRAL_USERNAME')

0 commit comments

Comments
 (0)