1+ /*
2+ Gradle build script for decimal-java.
3+
4+ Uploading archives:
5+
6+ publish -PcredentialsPassphrase=<credentials password>
7+ */
8+
19plugins {
210 id ' java-library'
3- id ' nu.studer.credentials' version ' 1.0.7 '
4- id ' maven'
11+ id ' nu.studer.credentials' version ' 3.0 '
12+ id ' maven-publish '
513 id ' signing'
614}
715
816group ' org.firebirdsql'
917version ' 1.0.1-SNAPSHOT'
1018
11- ext. isReleaseVersion = ! version. endsWith(" SNAPSHOT" )
12- ext. " signing.password" = credentials. " signing.password"
13- ext. ossrhPassword = credentials. ossrhPassword
19+ ext. ' signing.password' = credentials. forKey(' signing.password' )
20+ ext. ossrhPassword = credentials. forKey(' ossrhPassword' )
21+
22+ ext. isReleaseVersion = provider {
23+ ! version. endsWith(" SNAPSHOT" )
24+ }
1425
1526sourceCompatibility = JavaVersion . VERSION_1_7
1627targetCompatibility = JavaVersion . VERSION_1_7
@@ -19,6 +30,11 @@ repositories {
1930 mavenCentral()
2031}
2132
33+ java {
34+ withJavadocJar()
35+ withSourcesJar()
36+ }
37+
2238dependencies {
2339 testImplementation ' junit:junit:4.13.1'
2440}
@@ -47,66 +63,85 @@ jar {
4763 }
4864}
4965
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
66+ javadoc {
67+ options. author()
68+ options. windowTitle = " decimal-java API"
69+ options. docTitle = ' decimal-java'
70+ options. bottom = " Copyright © 2017-${ new Date().format("yyyy")} Jaybird (Firebird JDBC) team. All rights reserved."
71+ if (JavaVersion . current(). isJava9Compatible()) {
72+ options. addBooleanOption(' html5' , true )
73+ options. addBooleanOption(' Xdoclint:none' , true )
74+ }
6775}
6876
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 ' +
77+ publishing {
78+ publications {
79+ // Main maven artifact
80+ mavenJava(MavenPublication ) {
81+ from components. java
82+ pom {
83+ name = ' decimal-java'
84+ packaging = ' jar'
85+ description = ' A library to convert java.math.BigDecimal to and from ' +
8686 ' 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- }
87+ url = ' https://github.com/FirebirdSQL/decimal-java'
88+ inceptionYear = ' 2017'
9489
9590 licenses {
9691 license {
97- name ' The MIT License'
98- url ' https://opensource.org/licenses/MIT'
92+ name = ' The MIT License'
93+ url = ' https://opensource.org/licenses/MIT'
9994 }
10095 }
10196
10297 developers {
10398 developer {
104- id ' mrotteveel'
105- name ' Mark Rotteveel'
106- email ' mark@lawinegevaar.nl'
99+ id = ' mrotteveel'
100+ name = ' Mark Rotteveel'
101+ email = ' mark@lawinegevaar.nl'
102+ }
103+ }
104+
105+ scm {
106+ connection = ' scm:git:https://github.com/FirebirdSQL/decimal-java.git'
107+ developerConnection = ' scm:git:git@github.com:FirebirdSQL/decimal-java.git'
108+ url = ' https://github.com/FirebirdSQL/decimal-java'
109+ }
110+
111+ mailingLists {
112+ mailingList {
113+ name = ' firebird-java'
114+ subscribe = ' firebird-java+subscribe@googlegroups.com'
115+ unsubscribe = ' firebird-java+unsubscribe@googlegroups.com'
116+ post = ' firebird-java@googlegroups.com'
117+ archive = ' https://groups.google.com/g/firebird-java'
118+ otherArchives = [' http://fb-list-archive.s3-website-eu-west-1.amazonaws.com/firebird-java/index.html' ]
107119 }
108120 }
109121 }
110122 }
111123 }
124+ repositories {
125+ maven {
126+ url = project. isReleaseVersion. get() ? project. releaseRepository : project. snapshotRepository
127+ credentials {
128+ username = findProperty(' ossrhUsername' ) ?: null
129+ password = findProperty(' ossrhPassword' ) ?: null
130+ }
131+ }
132+ }
133+ }
134+
135+ tasks. withType(PublishToMavenRepository ). each {
136+ it. doFirst {
137+ if (findProperty(' ossrhUsername' ) == null || findProperty(' ossrhPassword' ) == null ) {
138+ throw new RuntimeException (' No credentials for publishing, make sure to specify the properties ' +
139+ ' credentialsPassphrase, or ossrhUsername and ossrhPassword. See devdoc/publish.md for details.' )
140+ }
141+ }
142+ }
143+
144+ signing {
145+ required { isReleaseVersion && gradle. taskGraph. hasTask(' :publish' ) }
146+ sign publishing. publications. mavenJava
112147}
0 commit comments