Skip to content

Commit

Permalink
fix plugin marker pom not containing name and description (#119)
Browse files Browse the repository at this point in the history
* fix plugin marker pom not containing name and description

* only apply workaround if elements are missing

* fix check

* don't crash if cast would fail
  • Loading branch information
gabrielittner authored Feb 23, 2020
1 parent 9ef18be commit 590b270
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
</scm>
<name>Gradle Maven Publish Plugin Test Artifact</name>
<description>Testing the Gradle Maven Publish Plugin</description>
<dependencies>
<dependency>
<groupId>com.example</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.vanniktech.maven.publish.tasks.EmptySourcesJar
import com.vanniktech.maven.publish.tasks.GroovydocsJar
import com.vanniktech.maven.publish.tasks.JavadocsJar
import com.vanniktech.maven.publish.tasks.SourcesJar
import groovy.util.NodeList
import org.gradle.api.Project
import org.gradle.api.publish.Publication
import org.gradle.api.publish.maven.MavenPublication
Expand Down Expand Up @@ -148,6 +149,16 @@ internal class MavenPublishConfigurer(
if (it.name == "${plugin.name}PluginMarkerMaven") {
// keep the current group and artifact ids, they are based on the gradle plugin id
configurePom(it, groupId = it.groupId, artifactId = it.artifactId)
// workaround for https://github.com/gradle/gradle/issues/12259
it.pom.withXml { pom ->
if ((pom.asNode().get("name") as? NodeList)?.isEmpty() == true) {
pom.asNode().appendNode("name", publishPom.name)
}
if ((pom.asNode().get("description") as? NodeList)?.isEmpty() == true) {
pom.asNode().appendNode("description", publishPom.description)
}
}

val emptyJavadocsJar = project.tasks.register("emptyJavadocsJar", EmptyJavadocsJar::class.java)
it.addTaskOutput(emptyJavadocsJar)
val emptySourcesJar = project.tasks.register("emptySourcesJar", EmptySourcesJar::class.java)
Expand Down

0 comments on commit 590b270

Please sign in to comment.