Duplicate artifactId in a baby pump

I want the parent pom to define some properties for a lot of child inheritance pumps. However, when I try to use artifactId in one of these properties in the parent pom, it duplicates in the child's effective pom. A very simple example below. Suppose I have all the valid fields needed for priests (groupId, version, packaging, etc.).

The parent pom effective pom has a scm connection value www.mysite.com/parent-pom. But in a child, the effective pom value has a scm bond value www.mysite.com/child-pom/child-pom. How to get this inheritance of the property and the general structure of the connection URL, without duplicate artifactId. I want the child pom to have a scm connection www.mysite.com/child-pom.

Parent:

<project>
  <artifactId>parent-pom</artifactId>
  <properties>
    <scmurl>www.mysite.com</scmurl>
  </properties>
  <scm>
    <connection>${scmurl}/${artifactId}</connection>
  </scm>
</project>

Child:

<project>
  <parent>
    <artifactId>parent-pom</artifactId>
  </parent>
  <artifactId>child-pom</artifactId>
</project>
+5
3

edwardmlyte,

, , .

Maven SCM , <scm> , , , SCM- . , url ${project.artifactId}, artifactId.

, :

project.scm.connection=${parent.scm.connection}/${project.artifactId}
project.scm.connection=${scmurl}/${project.artifactId}/${project.artifactId}
project.scm.connection=www.mysite.com/child-pom/child-pom

, url ${artifactId}, , URL- www.mysite.com/parent-pom/, , SCM , child-pom URL- , , .

2 :

,

pom.xml:

<scm>
    <connection>${scmurl}/${artifactId}</connection>
</scm>

, .

,

- :

<scm>
    <connection>${scmurl}/</connection>
</scm>

, URL-, .

, URL- :

<profile>
    <id>parent-profile</id>
    <scm>
        <connection>${scmurl}/parent-pom</connection>
    </scm>
</profile>


$ mvn -Pparent-profile ...

, pom .

, .

+4

- , @333kenshin , , .

pom <properties>

<git.account>xenworks</git.account>
<git.base>bitbucket.org/${git.account}/${project.artifactId}</git.base>
<git.conn>scm:git:https://${git.base}.git</git.conn>
<git.devConn>scm:git:ssh://git@${git.base}.git</git.devConn>
<git.url>https://${git.base}</git.url>

scm .

<scm>
  <connection>${git.conn}</connection>
  <developerConnection>${git.devConn}</developerConnection>
  <url>${git.url}</url>
  <tag>HEAD</tag>
</scm>

, , Maven Jira

+1

${scmurl}? url.

parent-pom :

 <scmurl>www.mysite.com</scmurl>

... , OQ:

/parent-pom$ mvn help:effective-pom
  ...
  <scm>
    <connection>www.mysite.com/parent-pom</connection>
  </scm>
  ...


<relativePath>../parent-pom</relativePath> ( , ) child-pom, parent-pom install ed Maven (). :

/child-pom$ mvn help:effective-pom
  ...
  <scm>
    <connection>www.mysite.com/child-pom/child-pom</connection>
  </scm>
  ...

. , () .

${artifactId} ${project.artifactId} - - .

<scm><connection>${scmurl}/${artifactId}</connection></scm> child-pom :

/child-pom$ mvn help:effective-pom
  ...
  <scm>
    <connection>www.mysite.com/child-pom</connection>
  </scm>
  ...

, khmarbaise .

0

Source: https://habr.com/ru/post/1664994/


All Articles