This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
Add sample demonstrating how to configure the mavenDeployer section from the uploadArchives task #142
Milestone
Comments
Here is a first attempt: val nexusUrl = "..."
val nexusUser = "..."
val nexusPassword = "..."
val springBootVersion = "..."
tasks {
"uploadArchives"(Upload::class) {
val mavenConvention = org.gradle.api.internal.plugins.DslObject(repositories).convention.getPlugin(MavenRepositoryHandlerConvention::class.java)
val mavenDeployer = mavenConvention.mavenDeployer()
mavenDeployer.run {
val repository = javaClass.getMethod("repository", Map::class.java)
.invoke(this, mapOf("url" to "$nexusUrl/releases"))
repository.javaClass.getMethod("authentication", Map::class.java)
.invoke(repository, mapOf("userName" to nexusUser, "password" to nexusPassword))
val snapshotRepository = javaClass.getMethod("snapshotRepository", Map::class.java)
.invoke(this, mapOf("url" to "$nexusUrl/snapshots"))
snapshotRepository.javaClass.getMethod("authentication", Map::class.java)
.invoke(snapshotRepository, mapOf("userName" to nexusUser, "password" to nexusPassword))
pom(closureOf<org.gradle.api.artifacts.maven.MavenPom> {
version = project.version.toString()
artifactId = "my-artifact"
groupId = "uk.com.foo.app"
project.parent.run {
groupId = "org.springframework.boot"
artifactId = "spring-boot-starter-parent"
version = springBootVersion
}
})
}
}
}
Then, to create repositories we need to invoke methods from the internal Finally the POM customization only need to use the |
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Jul 27, 2017
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Jul 27, 2017
bamboo
added a commit
that referenced
this issue
Jul 28, 2017
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 4, 2017
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 15, 2017
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 15, 2017
Also: - Add `Action<T>` overloads to `PomFilterContainer` - Add `Action<T>` overloads to `MavenRepositoryHandlerConvention` - Accept `maven` plugin API changes See gradle/kotlin-dsl-samples#142
3 tasks
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 18, 2017
Also: - Add `Action<T>` overloads to `PomFilterContainer` - Add `Action<T>` overloads to `MavenRepositoryHandlerConvention` - Accept `maven` plugin API changes See gradle/kotlin-dsl-samples#142
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 18, 2017
bamboo
added a commit
to gradle/gradle
that referenced
this issue
Aug 22, 2017
Also: - Add `Action<T>` overloads to `PomFilterContainer` - Add `Action<T>` overloads to `MavenRepositoryHandlerConvention` - Accept `maven` plugin API changes See gradle/kotlin-dsl-samples#142
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Groovy example:
The text was updated successfully, but these errors were encountered: