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() 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 { repositories {
mavenDeployer { maven {
if (!project.hasProperty('mavenDeployRepo')){ name = "MyRepo" // optional target repository name
throw new IllegalStateException("Set the property 'mavenDeployRepo' to the repository URL. A good place is ~/.gradle/gradle.properties") url = "${mavenDeployRepo}"
} }
repository(url: "${mavenDeployRepo}") }
println "publishing to: ${mavenDeployRepo}" }
publications {
mavenJava(MavenPublication) {
from components.java
} }
} }
} }
task sourcesJar(type: Jar, dependsOn: classes) { java {
classifier 'sources' withSourcesJar()
from sourceSets.main.allSource
} }
artifacts {
archives sourcesJar
}
// dependencies that all sub-projects have // dependencies that all sub-projects have
dependencies { dependencies {