Skip to content

Instantly share code, notes, and snippets.

@igouss
Created March 31, 2021 22:14
Show Gist options
  • Save igouss/be06fa12cb757b26e275a57b4dcfbd6d to your computer and use it in GitHub Desktop.
Save igouss/be06fa12cb757b26e275a57b4dcfbd6d to your computer and use it in GitHub Desktop.
gradle Export jar files
task exportApiServiceParametersJar(type : Jar) {
from { sourceSets.main.output.classesDirs } {
include "com/foo/api/service/parameters/**"
}
dependsOn compileJava
}
task exportApiPagingJar(type : Jar) {
from { sourceSets.main.output.classesDirs } {
include "com/foo/api/paging/**"
}
dependsOn compileJava
}
publishing {
repositories {
maven {
credentials {
username project.getProperty("nexusPublishUsername")
password project.getProperty("nexusPublishPassword")
}
if (project.version.endsWith('-SNAPSHOT')) {
url "https://nexus/repository/maven-snapshots/"
} else {
url "https://nexus/repository/maven-releases/"
}
}
}
publications {
exportApiServiceParameters(MavenPublication) {
groupId = 'com.foo.api.service'
artifactId = 'parameters'
artifact exportApiServiceParametersJar
}
exportApiPaging(MavenPublication) {
groupId = 'com.foo.api'
artifactId = 'paging'
artifact exportApiPagingJar
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment