Dependency to maven artifacts with parameterized artifactIds

I’m adding dependencies to my gradle project, where inside the pom.xml of those dependencies there are artifactIds which are parameterized.
For example the referenced pom contains the following section:

<dependencies>
    <dependency>
      <groupId>${project.parent.groupId}</groupId>
      <artifactId>${project.parent.artifactId}-api</artifactId>
      <version>${project.parent.version}</version>
    </dependency>
</dependencies>

This is a valid pom.xml, as far as I know and it works with maven.
But gradle does not resolve the parameters and tries to resolve a dependency with the literal artifactId, which of course does not work.

Does anyone have any ideas how I can work around this problem?
I guess in the long run, gradle should work with parameterized artifactIds correcly.

Would you mind providing your full pom.xml so I can reproduce the issue? Generally speaking, Gradle is supposed to handle property replacements as close as possible to a Maven implementation. You might still run into some feature parity here and there.

Hi Benjamin,

I can’t give you the pom files and you would not be able to reproduce it anyways, since a lot of the dependecies and in particular the ones causing the problems are private and only reside in our on-site Nexus Repository.
I will try to create a toy project to reproduce the problem.

A simple example would be great. Thanks for putting that together.

I had a deeper look at your issue.

The properties project.parent.groupId and project.parent.version are resolved properly. The property project.parent.artifactId is not resolved properly - the literal is used.

I raised the issue GRADLE-3299. The fix should be pretty straight forward. Would you be interested in contributing the fix?

I will look into this. Maybe I can figure it out.

Great. For more information on the contribution process please have a look the documentation.

I created a patch and requested a pull request on github.

Thanks for that. I already added a comment. The implementation looks good to me.