fix publish configuration

publish is now possible with the tasks publishToMavenLocal and
publishMavenJavaPublicationToMyRepoRepository
This commit is contained in:
2021-04-02 19:19:21 +02:00
parent d57c69119e
commit 2840fea751

View File

@@ -46,27 +46,33 @@ subprojects {
jcenter()
}
uploadArchives {
/**
* Publish the to a local repository.
* Use 'gradlew publishToMavenLocal' to publish to the local maven repo.
* If the property 'mavenDeployRepo' is set in gradle.properties, then you can use
* 'gradlew publishMavenJavaPublicationToMyRepoRepository' to publish to that repository.
*/
publishing {
if (project.hasProperty('mavenDeployRepo')){
repositories {
mavenDeployer {
if (!project.hasProperty('mavenDeployRepo')){
throw new IllegalStateException("Set the property 'mavenDeployRepo' to the repository URL. A good place is ~/.gradle/gradle.properties")
maven {
name = "MyRepo" // optional target repository name
url = "${mavenDeployRepo}"
}
repository(url: "${mavenDeployRepo}")
println "publishing to: ${mavenDeployRepo}"
}
}
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
java {
withSourcesJar()
}
artifacts {
archives sourcesJar
}
// dependencies that all sub-projects have
dependencies {