You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (Jira)" <ji...@apache.org> on 2020/05/03 11:29:00 UTC

[jira] [Closed] (MSHARED-408) EmbeddedMavenModelExposer ignores parent values in pom

     [ https://issues.apache.org/jira/browse/MSHARED-408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylwester Lachiewicz closed MSHARED-408.
----------------------------------------
    Resolution: Fixed

> EmbeddedMavenModelExposer ignores parent values in pom
> ------------------------------------------------------
>
>                 Key: MSHARED-408
>                 URL: https://issues.apache.org/jira/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
>            Assignee: Sylwester Lachiewicz
>            Priority: Minor
>             Fix For: maven-shared-jar-3.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)