1+ import java.time.LocalDate
2+
13plugins {
24 java
35 `maven- publish`
46 signing
7+ id(" org.jreleaser" ) version " 1.17.0"
58}
69
710group = " com.factset.sdk.eventdriven"
@@ -57,12 +60,13 @@ tasks.jar {
5760 }
5861}
5962
60- // https://docs.gradle.org/current/userguide/publishing_maven.html
61- publishing {
62- publications {
63- create<MavenPublication >(" mavenJava" ) {
63+ val releasesRepoUrl = layout.buildDirectory.dir(" repos/releases" )
64+ val snapshotsRepoUrl = layout.buildDirectory.dir(" repos/snapshots" )
6465
65- // dependencies
66+ // Configure publishing
67+ configure<PublishingExtension > {
68+ publications {
69+ register<MavenPublication >(" maven" ) {
6670 from(components[" java" ])
6771
6872 versionMapping {
@@ -77,22 +81,20 @@ publishing {
7781 pom {
7882 name.set(" FactSet Trading event-driven client library for Java" )
7983 description.set(" Event-driven api client for the FactSet Trading API" )
80- url.set(" https://github.com/factset/enterprise-sdk-eventdriven-factsettrading-java" )
84+ url.set(" https://github.com/factset/enterprise-sdk-eventdriven-factsettrading-java/ " )
8185 licenses {
8286 license {
8387 name.set(" The Apache License, Version 2.0'" )
8488 url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
8589 }
8690 }
87-
8891 developers {
8992 developer {
9093 id.set(" enterprisesdk" )
9194 organization.set(" FactSet" )
9295 organizationUrl.set(" https://developer.factset.com" )
9396 }
9497 }
95-
9698 scm {
9799 connection.set(" scm:git:git://github.com/factset/enterprise-sdk-eventdriven-factsettrading-java.git" )
98100 developerConnection.set(" scm:git:ssh://factset/enterprise-sdk-eventdriven-factsettrading-java.git" )
@@ -104,47 +106,56 @@ publishing {
104106
105107 repositories {
106108 maven {
107- var releasesRepoUrlEnv = System .getenv(" MAVEN_RELEASES_URL" )
108- var snapshotsRepoUrlEnv = System .getenv(" MAVEN_SNAPSHOTS_URL" )
109- var usernameEnv = System .getenv(" MAVEN_USERNAME" )
110- var passwordEnv = System .getenv(" MAVEN_PASSWORD" )
111-
112- if (releasesRepoUrlEnv == null ) {
113- releasesRepoUrlEnv = " "
114- project.logger.error(" MAVEN_RELEASES_URL not set" )
115- }
116-
117- if (snapshotsRepoUrlEnv == null ) {
118- snapshotsRepoUrlEnv = " "
119- project.logger.error(" MAVEN_SNAPSHOTS_URL not set" )
120- }
109+ // change URLs to point to your repos, e.g. http://my.org/repo
110+ url = if (version.toString().endsWith(" SNAPSHOT" )) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)
111+ }
112+ }
113+ }
121114
122- if (usernameEnv == null ) {
123- usernameEnv = " "
124- project.logger.error(" MAVEN_USERNAME not set" )
125- }
115+ configure< org.jreleaser.gradle.plugin.JReleaserExtension > {
116+ gitRootSearch.set(true )
117+ project {
118+ description = " Event-driven api client for the FactSet Trading API"
119+ authors = listOf (" FactSet" )
120+ license = " APACHE-2.0"
121+ inceptionYear = " 2023"
122+ vendor = " FactSet"
123+ copyright = " Copyright (c) ${LocalDate .now().year} FactSet"
124+ }
126125
127- if (passwordEnv == null ) {
128- passwordEnv = " "
129- project.logger.error( " MAVEN_PASSWORD not set " )
130- }
126+ signing {
127+ active.set(org.jreleaser.model. Active . ALWAYS )
128+ armored = true
129+ }
131130
132- val releasesRepoUrl = uri(releasesRepoUrlEnv)
133- val snapshotsRepoUrl = uri(snapshotsRepoUrlEnv)
134- url = if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl
131+ release {
132+ github {
133+ skipTag = true
134+ skipRelease = true
135+ }
136+ }
135137
136- credentials {
137- username = usernameEnv
138- password = passwordEnv
138+ deploy {
139+ maven {
140+ mavenCentral {
141+ register(" release-deploy" ) {
142+ active.set(org.jreleaser.model.Active .RELEASE )
143+ url = " https://central.sonatype.com/api/v1/publisher"
144+ stagingRepository(releasesRepoUrl.get().asFile.path)
145+ }
139146 }
140-
141- authentication {
142- create<BasicAuthentication >(" basic" )
147+ nexus2 {
148+ register(" snapshot-deploy" ) {
149+ active.set(org.jreleaser.model.Active .SNAPSHOT )
150+ url = " https://central.sonatype.com/repository/maven-snapshots/"
151+ snapshotUrl = " https://central.sonatype.com/repository/maven-snapshots/"
152+ applyMavenCentralRules = true
153+ snapshotSupported = true
154+ closeRepository = true
155+ releaseRepository = true
156+ stagingRepository(snapshotsRepoUrl.get().asFile.path)
157+ }
143158 }
144159 }
145160 }
146-
147- signing {
148- sign(publications[" mavenJava" ])
149- }
150- }
161+ }
0 commit comments