Skip to content

Commit 4da0a32

Browse files
authored
Merge pull request #201 from Ghost-chu/master
Gradle publish to CodeMC repo
2 parents 76b0182 + e0f4506 commit 4da0a32

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

build.gradle

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@ subprojects {
147147
rootProject.dependencies.compile project
148148
}
149149
}
150+
151+
publishing {
152+
publications {
153+
mavenJava(MavenPublication) {
154+
groupId = rootProject.group
155+
artifactId = "javabotblockapi-"+project.name
156+
version = rootProject.version
157+
158+
from components.java
159+
artifact javadocJar
160+
artifact sourceJar
161+
}
162+
}
163+
repositories {
164+
maven {
165+
url = "https://repo.codemc.io/repository/maven-releases/"
166+
167+
def mavenUsername = System.getenv("ORG_GRADLE_PROJECT_mavenUsername") ? System.getenv("ORG_GRADLE_PROJECT_mavenUsername") :
168+
System.getProperty("ORG_GRADLE_PROJECT_mavenUsername") ? System.getProperty("ORG_GRADLE_PROJECT_mavenUsername") : null
169+
def mavenPassword = System.getenv("ORG_GRADLE_PROJECT_mavenPassword") ? System.getenv("ORG_GRADLE_PROJECT_mavenPassword") :
170+
System.getProperty("ORG_GRADLE_PROJECT_mavenPassword") ? System.getProperty("ORG_GRADLE_PROJECT_mavenPassword") : null
171+
172+
if(mavenUsername != null && mavenPassword != null) {
173+
credentials {
174+
username = mavenUsername
175+
password = mavenPassword
176+
}
177+
}
178+
}
179+
}
180+
}
181+
150182
}
151183

152184
configurations {
@@ -181,36 +213,6 @@ task sourcesJar(type: Jar, dependsOn: classes){
181213
destinationDirectory = file("$rootDir/build/libs/")
182214
}
183215

184-
publishing {
185-
publications {
186-
mavenJava(MavenPublication) {
187-
groupId = rootProject.group
188-
artifactId = "JavaBotBlockAPI"
189-
version = rootProject.version
190-
191-
from components.java
192-
artifact javadocJar
193-
artifact sourcesJar
194-
}
195-
}
196-
repositories {
197-
maven {
198-
url = "https://repo.codemc.io/repository/maven-releases/"
199-
200-
def mavenUsername = System.getenv("ORG_GRADLE_PROJECT_mavenUsername") ? System.getenv("ORG_GRADLE_PROJECT_mavenUsername") :
201-
System.getProperty("ORG_GRADLE_PROJECT_mavenUsername") ? System.getProperty("ORG_GRADLE_PROJECT_mavenUsername") : null
202-
def mavenPassword = System.getenv("ORG_GRADLE_PROJECT_mavenPassword") ? System.getenv("ORG_GRADLE_PROJECT_mavenPassword") :
203-
System.getProperty("ORG_GRADLE_PROJECT_mavenPassword") ? System.getProperty("ORG_GRADLE_PROJECT_mavenPassword") : null
204-
205-
if(mavenUsername != null && mavenPassword != null) {
206-
credentials {
207-
username = mavenUsername
208-
password = mavenPassword
209-
}
210-
}
211-
}
212-
}
213-
}
214216

215217
class Version{
216218
String major, minor, patch

0 commit comments

Comments
 (0)