add distribution and pom to jar

This commit is contained in:
aanno 2021-02-09 13:00:55 +01:00
parent b5db40cb5f
commit 240892fa83
2 changed files with 35 additions and 0 deletions

View file

@ -2,7 +2,9 @@ plugins {
java
application
eclipse
`maven-publish`
`check-lib-versions`
`java-library-distribution`
}
val projectVersion: String by project
@ -39,6 +41,20 @@ configurations {
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
distributions {
main {
distributionBaseName.set("signal-cli")
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
@ -54,6 +70,11 @@ tasks.withType<Jar> {
"Maven-Group" to project.group
)
}
dependsOn("generatePomFileForMavenPublication")
into("META-INF/maven/${project.group}/${project.name}") {
from("$buildDir/publications/maven/pom-default.xml")
rename(".*", "pom.xml")
}
}
tasks.withType<JavaExec> {

View file

@ -1,6 +1,7 @@
plugins {
`java-library`
`check-lib-versions`
`maven-publish`
}
val projectVersion: String by project
@ -32,6 +33,14 @@ configurations {
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
tasks.withType<Jar> {
manifest {
attributes(
@ -43,6 +52,11 @@ tasks.withType<Jar> {
"Maven-Group" to project.group
)
}
dependsOn("generatePomFileForMavenPublication")
into("META-INF/maven/${project.group}/${project.name}") {
from("$buildDir/publications/maven/pom-default.xml")
rename(".*", "pom.xml")
}
}
tasks.withType<JavaCompile> {