-
Notifications
You must be signed in to change notification settings - Fork 9
/
maven.gradle
27 lines (23 loc) · 1.17 KB
/
maven.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
def properties = new Properties()
def propsFile = file("$rootDir/publish.properties")
if (propsFile.exists()) {
properties.load(propsFile.newInputStream())
}
/*
* 1. findProperty("sonatypeUsername"): use parameter from the command (if attached) so you can run ->
* /gradlew deploy -PsonatypeUsername={yourMavenUsername} -PsonatypePassword={yourMavenPassword}.
* 2. properties["sonatype.user"]: use property defined in publish.properties file in the root directory. If you have that file in the root
* of the project you can run -> ./gradlew deploy
* 3. System.getenv("SONATYPE_PASS"): use global variable defined in the system. No need to create publish.properties file, you can simply
* run -> ./gradlew deploy.
*/
ext.sonatype = [
url : properties["sonatype.url"]
?: "https://oss.sonatype.org/service/local/staging/deploy/maven2",
username: findProperty("sonatypeUsername")?.toString()
?: properties["sonatype.user"]
?: System.getenv("SONATYPE_USERNAME"),
password: findProperty("sonatypePassword")?.toString()
?: properties["sonatype.password"]
?: System.getenv("SONATYPE_PASS")
]