Skip to content

Commit 64809d2

Browse files
committed
Setup Maven Central / sonatype snapshot deployment
1 parent 9fe3634 commit 64809d2

File tree

2 files changed

+90
-10
lines changed

2 files changed

+90
-10
lines changed

build.gradle

Lines changed: 82 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
plugins {
22
id 'java-library'
3+
id 'nu.studer.credentials' version '1.0.7'
4+
id 'maven'
5+
id 'signing'
36
}
47

58
group 'org.firebirdsql'
69
version '1.0-SNAPSHOT'
710

11+
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
12+
ext."signing.password" = credentials."signing.password"
13+
ext.ossrhPassword = credentials.ossrhPassword
14+
815
sourceCompatibility = JavaVersion.VERSION_1_7
16+
targetCompatibility = JavaVersion.VERSION_1_7
917

1018
repositories {
1119
mavenCentral()
1220
}
1321

14-
jar {
15-
manifest {
16-
attributes(
17-
'Implementation-Title': project.name,
18-
'Implementation-Version': project.version,
19-
'Automatic-Module-Name': 'org.firebirdsql.decimal'
20-
)
21-
}
22+
dependencies {
23+
testImplementation 'junit:junit:4.12'
2224
}
2325

2426
sourceSets {
@@ -35,6 +37,76 @@ sourceSets {
3537
}
3638
}
3739

38-
dependencies {
39-
testImplementation 'junit:junit:4.12'
40+
jar {
41+
manifest {
42+
attributes(
43+
'Implementation-Title': project.name,
44+
'Implementation-Version': project.version,
45+
'Automatic-Module-Name': 'org.firebirdsql.decimal'
46+
)
47+
}
48+
}
49+
50+
task javadocJar(type: Jar) {
51+
archiveClassifier = 'javadoc'
52+
from javadoc
53+
}
54+
55+
task sourcesJar(type: Jar) {
56+
archiveClassifier = 'sources'
57+
from sourceSets.main.allSource
58+
}
59+
60+
artifacts {
61+
archives javadocJar, sourcesJar
62+
}
63+
64+
signing {
65+
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
66+
sign configurations.archives
4067
}
68+
69+
uploadArchives {
70+
repositories {
71+
mavenDeployer {
72+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
73+
74+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
75+
authentication(userName: ossrhUsername, password: ossrhPassword)
76+
}
77+
78+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
79+
authentication(userName: ossrhUsername, password: ossrhPassword)
80+
}
81+
82+
pom.project {
83+
name 'decimal-java'
84+
packaging 'jar'
85+
description 'A library to convert java.math.BigDecimal to and from ' +
86+
'IEEE-754r (IEEE-754-2008) decimal byte representations.'
87+
url 'https://github.com/FirebirdSQL/decimal-java'
88+
89+
scm {
90+
connection 'scm:git:https://github.com/FirebirdSQL/decimal-java.git'
91+
developerConnection 'scm:git:git@github.com:FirebirdSQL/decimal-java.git'
92+
url 'https://github.com/FirebirdSQL/decimal-java'
93+
}
94+
95+
licenses {
96+
license {
97+
name 'The MIT License'
98+
url 'https://opensource.org/licenses/MIT'
99+
}
100+
}
101+
102+
developers {
103+
developer {
104+
id 'mrotteveel'
105+
name 'Mark Rotteveel'
106+
email 'mark@lawinegevaar.nl'
107+
}
108+
}
109+
}
110+
}
111+
}
112+
}

devdoc/deploy.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Deploying
2+
=========
3+
4+
To deploy to Maven use
5+
6+
```
7+
gradlew uploadArchives -PcredentialsPassphrase=<password>
8+
```

0 commit comments

Comments
 (0)