Build: Add back hack for client copying client jar pom (#20577)
Gradle appears to have a bug in maven publshing which will not match the artifactId of a generated pom with the artifact id it puts in the file. This adds back a copy hack from the original pom file name to the client pom file name (which we had before #20403 inadvertently removed it).
This commit is contained in:
parent
38dce6384f
commit
6921b4a66b
|
@ -148,12 +148,17 @@ public class PluginBuildPlugin extends BuildPlugin {
|
|||
/** Adds a task to move jar and associated files to a "-client" name. */
|
||||
protected static void addClientJarTask(Project project) {
|
||||
Task clientJar = project.tasks.create('clientJar')
|
||||
clientJar.dependsOn(project.jar, project.javadocJar, project.sourcesJar)
|
||||
clientJar.dependsOn(project.jar, 'generatePomFileForClientJarPublication', project.javadocJar, project.sourcesJar)
|
||||
clientJar.doFirst {
|
||||
Path jarFile = project.jar.outputs.files.singleFile.toPath()
|
||||
String clientFileName = jarFile.fileName.toString().replace(project.version, "client-${project.version}")
|
||||
Files.copy(jarFile, jarFile.resolveSibling(clientFileName), StandardCopyOption.REPLACE_EXISTING)
|
||||
|
||||
String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom')
|
||||
String clientPomFileName = clientFileName.replace('.jar', '.pom')
|
||||
Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(clientPomFileName),
|
||||
StandardCopyOption.REPLACE_EXISTING)
|
||||
|
||||
String sourcesFileName = jarFile.fileName.toString().replace('.jar', '-sources.jar')
|
||||
String clientSourcesFileName = clientFileName.replace('.jar', '-sources.jar')
|
||||
Files.copy(jarFile.resolveSibling(sourcesFileName), jarFile.resolveSibling(clientSourcesFileName),
|
||||
|
@ -190,7 +195,7 @@ public class PluginBuildPlugin extends BuildPlugin {
|
|||
publications {
|
||||
clientJar(MavenPublication) {
|
||||
from project.components.java
|
||||
artifactId = artifactId + '-client'
|
||||
artifactId = project.pluginProperties.extension.name + '-client'
|
||||
pom.withXml { XmlProvider xml ->
|
||||
Node root = xml.asNode()
|
||||
root.appendNode('name', project.pluginProperties.extension.name)
|
||||
|
|
Loading…
Reference in New Issue