@@ -35,11 +35,10 @@ ext.servicesToPublish = [
3535]
3636
3737ext. zoweComponentsToPublish = ext. servicesToPublish + ext. javaLibraries
38- ext. projectsToPublish = ext. zoweComponentsToPublish + ext. enablers
3938
4039ext. sdksToPublish = ext. enablers + ext. javaLibraries
4140
42- configure(subprojects. findAll { it. name in projectsToPublish }) {
41+ configure(subprojects. findAll { it. name in zoweComponentsToPublish }) {
4342 apply plugin : ' maven-publish'
4443 apply plugin : ' java'
4544
@@ -71,12 +70,58 @@ configure(subprojects.findAll { it.name in projectsToPublish }) {
7170 }
7271}
7372
73+ // 1. Define properties for enablers
74+ def enablerProps = new Properties ()
75+ def enablerPropsFile = new File (rootProject. projectDir, " enabler.properties" )
76+
77+ // 2. Load the file if it exists
78+ if (enablerPropsFile. exists()) {
79+ enablerPropsFile. withInputStream { stream ->
80+ enablerProps. load(stream)
81+ }
82+ }
83+
84+ // 3. Get the version, or use the rootProject.version as a fallback
85+ def sdkVersion = enablerProps. getProperty(" version" )
86+
87+ configure(subprojects. findAll { it. name in sdksToPublish }) {
88+ apply plugin : ' maven-publish'
89+ apply plugin : ' java'
90+
91+ publishing {
92+ repositories. maven {
93+ credentials {
94+ username project. hasProperty(" zowe.deploy.username" ) ? project. getProperty(" zowe.deploy.username" ) : " "
95+ password project. hasProperty(" zowe.deploy.password" ) ? project. getProperty(" zowe.deploy.password" ) : " "
96+ }
97+ if (sdkVersion. endsWith(" -SNAPSHOT" )) {
98+ setUrl(artifactoryPublishingMavenSnapshotRepo)
99+ } else {
100+ setUrl(artifactoryPublishingMavenRepo)
101+ }
102+ }
103+
104+ publications {
105+ mavenJava(MavenPublication ) {
106+ pom {
107+ licenses {
108+ license {
109+ name = ' Eclipse Public License, v2.0'
110+ url = ' https://www.eclipse.org/legal/epl-2.0/'
111+ }
112+ }
113+ }
114+ }
115+ }
116+ }
117+ }
118+
74119configure(subprojects. findAll { it. name in sdksToPublish }) {
75120 publishing {
76121 publications {
77122 mavenJava(MavenPublication ) {
78123 groupId ' org.zowe.apiml.sdk'
79- version rootProject . version
124+ version sdkVersion
80125 artifactId " ${ project.name} "
81126
82127 from components. java
@@ -95,11 +140,11 @@ configure(subprojects.findAll { it.name in sdksToPublish }) {
95140 tasks. withType(Jar ) {
96141 manifest {
97142 attributes " Specification-Title" : project. name
98- attributes " Specification-Version" : rootProject . version
143+ attributes " Specification-Version" : sdkVersion
99144 attributes " Specification-Vendor" : " Zowe org"
100145
101146 attributes " Implementation-Title" : project. name
102- attributes " Implementation-Version" : rootProject . version
147+ attributes " Implementation-Version" : sdkVersion
103148 attributes " Implementation-Vendor" : " Zowe org"
104149 attributes " Implementation-Vendor-Id" : " org.zowe.apiml.sdk"
105150 }
0 commit comments