0

I have multiple Maven modules, let's say A, B, C and I also have a module D.

Can module D have dependencies to A, B, C without explicitly setting their version? In other words, I'd like module D to be built with the latest code of the other modules.

greenButMellow
  • 316
  • 1
  • 9
  • If you have a multi module build you can use `${project.version}`..as version for the dependencies on other modules.. that is one solution. The other is to define a dependencyManagement in root and so that means to omit the version tag in the appropriate modules... – khmarbaise Jan 29 '23 at 17:22
  • It could be possible to make a hacky way. Just use a SNAPSHOT version like `1.0-SNAPSHOT` which means it's always the latest version via `mvn -U package`... but it's not reproducible... – khmarbaise Jan 29 '23 at 17:25

1 Answers1

0

You could just set a minimum version of modules A,B,C in your D module, as per https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402

like you can set your dependency version as [1.5,) wich means any version greater than or equal to 1.5

Or you could use "RELEASE" versions, for more information on this please see this other SO question where Rich gives a very good explanation:

https://stackoverflow.com/a/1172371/14650195

  • The linked reference is out of date in many ways. A version range might not the best idea. The suggested `RELEASE` version will not work and it deprecated for a very long time ... – khmarbaise Jan 29 '23 at 17:28