Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plugins {
- maven
- `maven-publish`
- }
- publishing {
- val repositoryUrl: String by project
- val repositoryUser: String by project
- val repositoryPassword: String by project
- val sourcesJar by tasks.registering(Jar::class) {
- classifier = "sources"
- from(sourceSets.main.get().allSource)
- }
- repositories {
- maven {
- url = uri(repositoryUrl)
- credentials {
- username = repositoryUser
- password = repositoryPassword
- }
- }
- }
- publications {
- register("mavenJava", MavenPublication::class) {
- from(components["java"])
- artifact(sourcesJar.get())
- }
- }
- }
- getByName<Upload>("uploadArchives") {
- val repositoryUrl: String by project
- val repositoryUser: String by project
- val repositoryPassword: String by project
- repositories {
- withConvention(MavenRepositoryHandlerConvention::class) {
- mavenDeployer {
- withGroovyBuilder {
- "repository"("url" to uri(repositoryUrl)) {
- "authentication"("userName" to repositoryUser, "password" to repositoryPassword)
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment