apache / apache/maven-dependency-plugin

[MDEP-910] No hardcoded groupId needed for automatic module/parent resolving in Maven 4

Open
#1,426 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Matthias Bünger](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER302100)** opened **[MDEP-910](https://issues.apache.org/jira/browse/MDEP-910?redirect=false)** and commented

I was asking this on the dev-list last week, but as nobody could answer it (or at least nobody did answer) I got the feeling that this might be some unseen/unwanted implementation detail. If I'm wrong please give me a short explanation for my understanding and ofc close the issue:

---

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.

```xml


${project.groupId}
ModuleA
${project.version}

```

With automatic versioning in Maven 4 you can write

```xml


test.bukama.maven
ModuleA

```

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

```xml


${project.groupId}
ModuleA

```

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 :)

---

**Affects:** waiting-for-feedback

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Maven 4 multi-module examples in the module pom.xml files, comparing a hardcoded groupId with ${project.groupId} and omitted versions. Review the reported missing-version error and determine whether the behavior needs a code change or only an explanation; done means the expected groupId and version resolution behavior is decided and documented or fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.