Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change how closeAndReleaseRepository is created to avoid ClassCastException #157

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ package com.vanniktech.maven.publish.nexus

import com.vanniktech.maven.publish.MavenPublishPluginExtension
import org.gradle.api.Project
import org.gradle.api.UnknownTaskException

class NexusConfigurer(project: Project) {
init {
val mavenPublishPluginExtension = project.extensions.getByType(MavenPublishPluginExtension::class.java)

// create on rootProject so that it only exists once
// there is no maybeRegister https://github.com/gradle/gradle/issues/6243
val task = project.rootProject.tasks.maybeCreate("closeAndReleaseRepository", CloseAndReleaseRepositoryTask::class.java)
task.description = "Closes and releases an artifacts repository in Nexus"
task.group = "release"
task.nexusOptions = mavenPublishPluginExtension.nexusOptions
try {
project.rootProject.tasks.named("closeAndReleaseRepository")
} catch (e: UnknownTaskException) {
project.rootProject.tasks.register("closeAndReleaseRepository", CloseAndReleaseRepositoryTask::class.java) {
it.description = "Closes and releases an artifacts repository in Nexus"
it.group = "release"
it.nexusOptions = mavenPublishPluginExtension.nexusOptions
}
}
}
}