11/* *****************************************************************************
2- * Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
2+ * Copyright 2009-2024 Exactpro (Exactpro Systems Limited)
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1414 * limitations under the License.
1515 ******************************************************************************/
1616
17+ plugins {
18+ id ' jacoco'
19+ }
20+
1721allprojects {
1822 ext {
1923 sharedDir = file(" ${ project.rootDir} /shared" )
@@ -22,8 +26,8 @@ allprojects {
2226 genDir = file(" ${ srcDir} /gen" )
2327 genJavaDir = file(" ${ genDir} /java" )
2428
25- incremental_build = project. hasProperty(' i' ) ? true : false
26- sonatype_publish = project. hasProperty(' sonatypePublish ' ) ? true : false
29+ incremental_build = project. hasProperty(' i' )
30+ sonatype_publish = project. hasProperty(' ossrhUsername ' ) && project . hasProperty( ' ossrhPassword ' )
2731
2832 // Set defaults
2933 if (! project. hasProperty(" revision" )) {
@@ -37,34 +41,33 @@ allprojects {
3741 }
3842 // Lib versions
3943 version_slf4j = ' 1.7.5'
40-
41- exactproVersion = ' 12'
4244 }
4345}
4446
47+ version = " ${ quickfixjPrefixVersion} .${ exactproVersion} "
48+
4549subprojects {
4650 apply plugin : ' eclipse'
47- apply plugin : ' jacoco'
4851 apply plugin : ' java'
49- apply plugin : ' maven'
52+ apply plugin : ' maven-publish '
5053
5154 if (sonatype_publish) {
5255 apply plugin : ' signing'
5356 }
5457
5558 group = ' com.exactpro.quickfixj'
56- version = " 1.6.0.${ exactproVersion} "
5759
58- sourceCompatibility = 1.7 // Java version compatibility to use when compiling Java source.
59- targetCompatibility = 1.7 // Java version to generate classes for.
60+ sourceCompatibility = JavaVersion . VERSION_1_7 // Java version compatibility to use when compiling Java source.
61+ targetCompatibility = JavaVersion . VERSION_1_7 // Java version to generate classes for.
6062 compileJava. options. debugOptions. debugLevel = " source,lines,vars" // Include debug information
6163
6264 buildscript { // artifacrory plugin
6365 repositories {
64- jcenter()
66+ mavenCentral()
67+ gradlePluginPortal()
6568 }
6669 dependencies {
67- classpath(group : ' org.jfrog.buildinfo' , name : ' build-info-extractor-gradle' , version : ' 2.2.+ ' )
70+ classpath(group : ' org.jfrog.buildinfo' , name : ' build-info-extractor-gradle' , version : ' 4.4.12 ' )
6871 classpath(group : ' com.netflix.nebula' , name : ' gradle-extra-configurations-plugin' , version : ' 2.2.+' )
6972 }
7073
@@ -78,11 +81,12 @@ subprojects {
7881 name ' MavenLocal' // for local builds only
7982 url sharedDir
8083 }
81- jcenter()
84+ mavenCentral()
85+ gradlePluginPortal()
8286 }
8387
8488 configurations {
85- compile . exclude module : ' avalon-framework-api'
89+ implementation . exclude module : ' avalon-framework-api'
8690
8791 all {
8892 transitive = true
@@ -127,66 +131,79 @@ subprojects {
127131 }
128132 }
129133
130- uploadArchives {
131- repositories {
132- mavenDeployer {
133- if (sonatype_publish) {
134- beforeDeployment {
135- MavenDeployment deployment -> signing. signPom(deployment)
136- }
137-
138- repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2" ) {
139- authentication(userName : ossrhUsername, password : ossrhPassword)
140- }
141-
142- snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots" ) {
143- authentication(userName : ossrhUsername, password : ossrhPassword)
144- }
134+ publishing {
135+ publications {
136+ mavenJava(MavenPublication ) {
137+ from components. java
145138
146- pom. project {
147- name ' Exactpro QuickFixJ'
139+ if (sonatype_publish) {
140+ pom {
141+ name = ' Exactpro QuickFixJ'
148142 packaging ' jar'
149143 // optionally artifactId can be defined here
150144 description ' QuickFixJ is one of such libraries we depend on and which was modified by Exactpro.'
151- url ' https://github.com/Exactpro/quickfixj '
145+ url = vcsUrl
152146
153147 scm {
154- connection ' scm:git:https://github.com/Exactpro/quickfixj'
155- developerConnection ' scm:git:https://github.com/Exactpro/quickfixj'
156- url ' https://github.com/Exactpro/quickfixj '
148+ connection = ' scm:git:https://github.com/Exactpro/quickfixj'
149+ developerConnection = ' scm:git:https://github.com/Exactpro/quickfixj'
150+ url = vcsUrl
157151 }
158152
159153 licenses {
160154 license {
161- name ' The Apache License, Version 2.0'
162- url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
155+ name = ' The Apache License, Version 2.0'
156+ url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
163157 }
164158 }
165159
166160 developers {
167161 developer {
168- id ' Nikita-Smirnov-Exactpro'
169- name ' Nikita Smirnov'
170- email ' nikita.smirnov@exactprosystems.com'
162+ id = ' Nikita-Smirnov-Exactpro'
163+ name = ' Nikita Smirnov'
164+ email = ' nikita.smirnov@exactprosystems.com'
171165 }
172166 }
173167 }
174- } else {
175- // uniqueVersion = false // publish non unique snapshots to local repository
176- repository(url : " file://${ sharedDir} " )
177168 }
178169 }
179170 }
180- doFirst { sharedDir. mkdirs() }
171+
172+ repositories {
173+ if (sonatype_publish) {
174+ maven {
175+ url = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
176+ credentials {
177+ username = ossrhUsername
178+ password = ossrhPassword
179+ }
180+ }
181+ maven {
182+ url = " https://oss.sonatype.org/content/repositories/snapshots"
183+ credentials {
184+ username = ossrhUsername
185+ password = ossrhPassword
186+ }
187+ }
188+ } else {
189+ // uniqueVersion = false // publish non unique snapshots to local repository
190+ sharedDir. mkdirs()
191+ maven {
192+ url = " file://${ sharedDir} "
193+ }
194+ }
195+ }
181196 }
182197
183- task sourcesJar(type : Jar , dependsOn : classes) {
184- classifier = ' sources'
198+ tasks. register(' sourcesJar' , Jar ) {
199+ dependsOn classes
200+ archiveClassifier = ' sources'
185201 from sourceSets. main. allSource
186202 }
187203
188- task javadocJar(type : Jar , dependsOn : classes) {
189- classifier = ' javadoc'
204+ tasks. register(' javadocJar' , Jar ) {
205+ dependsOn classes
206+ archiveClassifier = ' javadoc'
190207 from javadoc
191208 }
192209
@@ -195,6 +212,12 @@ subprojects {
195212 }
196213
197214 if (sonatype_publish) {
215+ tasks. withType(Sign ). configureEach {
216+ onlyIf {
217+ project. hasProperty(' signing.keyId' ) && project. hasProperty(' signing.password' )
218+ }
219+ }
220+
198221 signing {
199222 sign configurations. archives
200223 }
0 commit comments