rbygrave commented on issue #11500:
URL: https://github.com/apache/maven/issues/11500#issuecomment-3767388862
Given that `groupId` `artifactId` and `version` can be combined with a colon
delimiter. We can compare and contrast using gav as 3 attributes `groupId,
artifactId, version` vs a combined `id` attribute.
### Examples for comparison
#### Option A - separate `groupId, artifactId, version` attributes
```xml
<dependency groupId="org.slf4j" artifactId="slf4j-api" version="2.0.17"/>
<dependency groupId="org.postgresql" artifactId="postgresql"
version="42.7.3"/>
<!-- an annotation processor -->
<dependency groupId="io.ebean" artifactId="querybean-generator"
version="17.2.0" type="processor" scope="provided"/>
<!-- test dependencies -->
<dependency groupId="org.junit.jupiter" artifactId="junit-jupiter-api"
version="5.14.1" scope="test"/>
<dependency groupId="org.assertj" artifactId="assertj-core" version="3.27.6"
scope="test"/>
...
```
#### Option B - combined `id` attribute (for gav)
```xml
<dependency id="org.slf4j:slf4j-api:2.0.17"/>
<dependency id="org.postgresql:postgresql:42.7.3"/>
<!-- an annotation processor -->
<dependency id="io.ebean:querybean-generator:17.2.0" type="processor"
scope="provided"/>
<!-- test dependencies -->
<dependency id="org.junit.jupiter:junit-jupiter-api:5.14.1" scope="test"/>
<dependency id="org.assertj:assertj-core:3.27.6" scope="test"/>
...
```
--------
So with the combined `id` attribute, it could look like:
```xml
<dependency id="${groupId}:${artifactId}:${version}"
type="..."
classifier="..."
scope="..."
optional="..."
> <!-- new attributes -->
<groupId/> <!-- existing elements -->
<artifactId/>
<type/>
<classifier/>
<scope/>
<systemPath/>
<exclusions>
<exclusion id="${groupId}:${artifactId}"> <!-- new attribute -->
<groupId/> <!-- existing exclusion elements -->
<artifactId/>
</exclusion>
</exclusions>
<optional/>
</dependency>
```
A potential issue with the `id` is that on the dependency element it's a
groupId + artifactId + version but on the exclusion it's only a groupId +
artifactId [no version expected / needed].
##### Example exclusion
```xml
<dependency groupId="org.postgresql" artifactId="postgresql"
version="42.7.3">
<exclusions>
<exclusion groupId="*" artifactId="*"/>
</exclusions>
</dependency>
```
```xml
<dependency id="org.postgresql:postgresql:42.7.3">
<exclusions>
<exclusion id="*:*"/>
</exclusions>
</dependency>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]