Hey all,
I was double checking my Maven 4 examples and was wondering why
automatic version resolving of module dependencies only works when the
groupId is set fixed, but not working when using the project's variable.

To make my question clearer - let's assume a multi-module project with
groupId "test.bukama.maven" and two modules ("ModuleA" and "ModuleB")
where one has the other as a dependency (It's the same with parent
versioning, not only module dependencies btw):

In Maven 3.9.x you can define a module dependencies using projects
variables for "groupId" and "version", e.g.

  <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ModuleA</artifactId>
        <version>${project.version}</version>
    </dependency>
  </dependencies>

With automatic versioning in Maven 4 you can write

  <dependencies>
      <dependency>
        <groupId>test.bukama.maven</groupId>
        <artifactId>ModuleA</artifactId>
    </dependency>
  </dependencies>

and get rid fo the repeatabled versions. But when you use the project's
variable for the groupId like in Maven 3.9.x

  <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ModuleA</artifactId>
    </dependency>
  </dependencies>

you get an error that the version definition is missing:

[ERROR]   The project test.bukama.maven:ModuleB:0.0.1-SNAPSHOT
(D:\Github\Maven4\Maven4\ModuleB\pom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for
test.bukama.maven:ModuleA:jar is missing. @
test.bukama.maven:ModuleB:[unknown-version],
D:\Github\Maven4\Maven4\ModuleB\pom.xml, line 11, column 9

The "root" attribute is set to "true" in parent-pom and not set in the
module-poms!

As I havn't found anything on the JIRA about this (but maybe overseen
it), may I ask why you have to hardcode the groupId for automatic
versioning to work? Why Maven 4 assumes the parents project version for
the missing version but does not do the same for the groupId?

Thank you!
Matthias

P.S. For me personal the best would be to only write the artifact of the
projects own module (I think was working in alpha1-snapshot back then if
I remember correctly), but getting rid of the version is most important
for me :)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to