Replace module name when publishing

22 views Asked by At

I want to publish library of two subprojects: A and B.
A depends on B:

dependencies {
  implementation(project(":b"))
}

Specifying for both subprojects group = "com.example" and version = "1.0", after publishing I see this dependency in POM as

<dependency>
  <groupId>com.example</groupId>
  <artifactId>b</artifactId>
  <version>1.0</version>
  <scope>runtime</scope>
</dependency>

But I need this dependency will be published as "c" instead of "b", i.e.

<artifactId>c</artifactId>

How can I get it without renaming subproject "b" to "c"?

Have tried to use

configurations.all {
  resolutionStrategy.eachDependency {
    if (requested.group == "com.example") {
      useTarget("com.example:c:1.0")
    }
  }
}

and

configurations.all {
  resolutionStrategy.dependencySubstitution {
    substitute(module("com.example:b:1.0")).using(module("com.example:c:1.0"))
  }
}

, but it result in error Could not find com.example:c:1.0

0

There are 0 answers