[GRADLE-1238] POM generated by Maven plugin includes wrong artifactId in case of ProjectDependency Created: 29/Nov/10  Updated: 04/Jan/13  Resolved: 28/Nov/12

Status: Resolved
Project: Gradle
Affects Version/s: 0.9-rc-3
Fix Version/s: 1.1-rc-1

Type: Bug
Reporter: Artur Nowak Assignee: Unassigned
Resolution: Duplicate Votes: 1

Issue Links:
Duplicate
Duplicates GRADLE-443 Generated POM dependencies do not res... Resolved

 Description   

If a given project depends on another one which customizes artifact base name or specifies more than one artifact build specification, as in:

dependencies {
  // the following one sets jar.baseName to 'shared'
  compile project(':Common')
  // 'api' configuration emits jar called 'server-api'
  compile project(path: ':Server', configuration: 'api')
}

then the generated pom.xml for these dependencies sets the archive names as their artifactId. Unfortunately, generated pom.xml for the dependent project uses project names nevertheless.

I'm not perfectly sure if this is a bug, i.e. if this use case cannot be satisfied by defining dependencies in some other way. However, this dependency configuration works for all the other plugins, so I think that if it needs tweaking for maven-plugin, then it should be described in the configuration.

I've edited subprojects/gradle-core/src/test/groovy/org/gradle/api/internal/artifacts/publish/maven/dependencies/DefaultPomDependenciesConverterTest.java to add a test that presents this scenario. Also note that the equals function implemented in this class is totally broken (it compares lhs with itself).

I've also extended subprojects/gradle-core/src/test/groovy/org/gradle/api/internal/artifacts/publish/maven/dependencies/DefaultPomDependenciesConverter.java with a solution that works OK for a given scenario.

Both files can be found in the following branch of my GitHub fork: https://github.com/anowak/gradle/tree/wrongArchiveNamesInPom


Generated at Wed Jun 30 11:50:29 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.