gradle-release icon indicating copy to clipboard operation
gradle-release copied to clipboard

Releasing a multimodule-project with dependencies on themselves

Open thamacher opened this issue 7 years ago • 4 comments

How can I release a mutlimodule-projects, that have dependencies on each other. Example

root

  • sub1
  • sub2 (depends on sub1)
  • sub3 (depends on sub1 and sub2)
  • sub4 (depends on sub1 and sub2)

What happens now is the following error: Execution failed for task ':groupId:sub3:checkSnapshotDependencies'. 12:32:32 > Snapshot dependencies detected: 12:32:32 sub3: [net.researchgate.release.ReleaseExtension_Decorated@1c43b1a2:sub1:0.1-SNAPSHOT, net.researchgate.release.ReleaseExtension_Decorated@7f5c7189:sub2:0.1-SNAPSHOT]

How can I come around this?

thamacher avatar Mar 01 '18 13:03 thamacher

The easiest and best way for this is to use the same version on all projects and only apply the release plugin to the root project. This way it changes the version only one time and then builds and uploads all projects at once with their release version. I prefer this way as it's easy to see that versions rely on each other. A drawback is that even without a change you will have a new released version for a project.

Hillkorn avatar Mar 02 '18 09:03 Hillkorn

Thanks for this answer. This is exactly how I solved it now and it works totally fine with my requirements. Unfortunately now there is some trouble with the „maven-publish“ plugin, as only 2 of the 4 submodules are published. Do you have any experience with the combination of these 2 plugins?

thamacher avatar Mar 02 '18 17:03 thamacher

Not really. We use the maven plugin. I thought about to move to maven-publish but at the moment there is no need for it and maven-publish is still incubating

Did you cheched that the publish tasks are all depending on the afterRelease step of the release plugin? And that the artifacts have been build?

Hillkorn avatar Mar 06 '18 11:03 Hillkorn

Can any of you post an example configuration for this please?

laxika avatar Mar 31 '18 06:03 laxika