fix publish configuration
publish is now possible with the tasks publishToMavenLocal and publishMavenJavaPublicationToMyRepoRepository
This commit is contained in:
34
build.gradle
34
build.gradle
@@ -45,28 +45,34 @@ subprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives {
|
/**
|
||||||
repositories {
|
* Publish the to a local repository.
|
||||||
mavenDeployer {
|
* Use 'gradlew publishToMavenLocal' to publish to the local maven repo.
|
||||||
if (!project.hasProperty('mavenDeployRepo')){
|
* If the property 'mavenDeployRepo' is set in gradle.properties, then you can use
|
||||||
throw new IllegalStateException("Set the property 'mavenDeployRepo' to the repository URL. A good place is ~/.gradle/gradle.properties")
|
* 'gradlew publishMavenJavaPublicationToMyRepoRepository' to publish to that repository.
|
||||||
|
*/
|
||||||
|
publishing {
|
||||||
|
if (project.hasProperty('mavenDeployRepo')){
|
||||||
|
repositories {
|
||||||
|
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) {
|
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user