[ https://jira.codehaus.org/browse/MSHARED-408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Markus Bollerey updated MSHARED-408:
------------------------------------
Description:
Many Maven archives define a parent in their pom and leave values of groupId and/or version
to parent. Consequently they then do not define explicit values for groupId and/or version
again.
Because this exposer implementation does not read parent values, it often finds no groupId
and/or version where in Maven terms is one defined (in the parent).
Solution:
Just add the following six lines of code ('NEW') to the existing four lines ('OLD') adding
values to the <identification> instance. Don't remove any of the existing code, just
insert the new ones before as shown:
NEW1: // read parent values first
NEW2: if (model.getParent() != null) {
NEW3:
NEW4: identification.addAndSetGroupId(model.getParent().getGroupId());
NEW5: identification.addAndSetVersion(model.getParent().getVersion());
NEW6: }
OLD1: identification.addAndSetGroupId(model.getGroupId());
OLD2: identification.addAndSetArtifactId(model.getArtifactId());
OLD3: identification.addAndSetVersion(model.getVersion());
OLD4: identification.addAndSetName(model.getName());
was:
Many Maven archives define a parent in their pom and leave values of groupId and/or version
to parent. Consequently they then do not define explicit values for groupId and/or version
again.
Because this exposer implementation does not read parent values, it often finds no groupId
and/or version where in Maven terms is one defined (in the parent).
Solution:
Just add the following two lines of code ('NEW') to the existing four lines ('OLD') adding
values to the <identification> instance. Don't remove any of the existing code, just
insert the new ones before as shown:
NEW: // read parent values first
NEW: identification.addAndSetGroupId(model.getParent().getGroupId());
NEW: identification.addAndSetVersion(model.getParent().getVersion());
OLD: identification.addAndSetGroupId(model.getGroupId());
OLD: identification.addAndSetArtifactId(model.getArtifactId());
OLD: identification.addAndSetVersion(model.getVersion());
OLD: identification.addAndSetName(model.getName());
> EmbeddedMavenModelExposer ignores parent values in pom
> ------------------------------------------------------
>
> Key: MSHARED-408
> URL: https://jira.codehaus.org/browse/MSHARED-408
> Project: Maven Shared Components
> Issue Type: Bug
> Components: maven-shared-jar
> Affects Versions: maven-shared-jar-1.1
> Environment: not depending on environment
> Reporter: Markus Bollerey
> Priority: Minor
>
> Many Maven archives define a parent in their pom and leave values of groupId and/or version
to parent. Consequently they then do not define explicit values for groupId and/or version
again.
> Because this exposer implementation does not read parent values, it often finds no groupId
and/or version where in Maven terms is one defined (in the parent).
> Solution:
> Just add the following six lines of code ('NEW') to the existing four lines ('OLD') adding
values to the <identification> instance. Don't remove any of the existing code, just
insert the new ones before as shown:
> NEW1: // read parent values first
> NEW2: if (model.getParent() != null) {
> NEW3:
> NEW4: identification.addAndSetGroupId(model.getParent().getGroupId());
> NEW5: identification.addAndSetVersion(model.getParent().getVersion());
> NEW6: }
> OLD1: identification.addAndSetGroupId(model.getGroupId());
> OLD2: identification.addAndSetArtifactId(model.getArtifactId());
> OLD3: identification.addAndSetVersion(model.getVersion());
> OLD4: identification.addAndSetName(model.getName());
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)
|