1
1
/* Maven publish - start */
2
- task sourcesJar ( type : Jar ) {
3
- archiveClassifier = " sources"
2
+ tasks . register( " sourcesJar " , Jar ) {
3
+ archiveClassifier. set( " sources" )
4
4
from sourceSets. main. allJava
5
5
}
6
6
7
- task javadocJar (type : Jar , dependsOn : javadoc) {
8
- archiveClassifier = " javadoc"
9
- from javadoc. destinationDir
7
+ tasks. register(" javadocJar" , Jar ) {
8
+ dependsOn tasks. named(" javadoc" , Javadoc )
9
+ archiveClassifier. set(" javadoc" )
10
+ from { tasks. named(" javadoc" , Javadoc ). get(). destinationDir }
10
11
}
11
12
12
13
@@ -15,15 +16,10 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha
15
16
// snapshot version differs from normal version
16
17
String versionString = project. getProperty(' deployVersion' )
17
18
18
- signing {
19
- required { ! versionString. endsWith(' SNAPSHOT' ) }
20
- if (required)
21
- sign(publishing. publications)
22
- }
23
19
24
20
publishing {
25
21
publications {
26
- mavenJava( MavenPublication ) {
22
+ create( " mavenJava " , MavenPublication ) {
27
23
28
24
versionMapping {
29
25
// resolves dynamic versioning to current version number
@@ -66,13 +62,13 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha
66
62
}
67
63
68
64
removeTestDependenciesFromPom(pom)
69
- groupId group
70
- artifactId ' simonaAPI'
71
- version versionString
65
+ groupId = group
66
+ artifactId = ' simonaAPI'
67
+ version = versionString
72
68
73
69
from components. java
74
- artifact sourcesJar
75
- artifact javadocJar
70
+ artifact tasks . named( " sourcesJar" )
71
+ artifact tasks . named( " javadocJar" )
76
72
}
77
73
}
78
74
repositories {
@@ -86,13 +82,17 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha
86
82
}
87
83
}
88
84
}
85
+ signing {
86
+ useInMemoryPgpKeys(
87
+ findProperty(' signingKey' ) as String ,
88
+ findProperty(' signingPassword' ) as String
89
+ )
90
+ sign publications. mavenJava
91
+ }
89
92
}
90
93
91
-
92
- model {
93
- tasks. generatePomFileForMavenJavaPublication {
94
- destination = file(" $buildDir /generated-pom.xml" )
95
- }
94
+ tasks. named(" generatePomFileForMavenJavaPublication" ) {
95
+ destination = layout. buildDirectory. file(" generated-pom.xml" ). get(). asFile
96
96
}
97
97
}
98
98
0 commit comments