简体   繁体   中英

Append to parent pom property in child pom from command line or pom file

Suppose that i have some property in parent pom ie testProperty

I know that I can replace that value in child pom using:

<properties>
    <testProperty>new value</testProperty>
</properties>

Is there a way to append in child pom some value to that property?

This does not work:

<properties>
    <testProperty>${testProperty} appended value</testProperty>
</properties>

I'm looking for the solution where I can do that from command line when executing mvn command but if this is not possible i have to somehow append it inside pom.xml file

I'm not sure if user-defined properties are available on the command line. But within the POM, you can introduce another property as shown.

Parent:

<properties>
    <baseProperty>new value</baseProperty>
    <testProperty>${baseProperty}</testProperty>
</properties>

Child:

<properties>
    <testProperty>${baseProperty} appended value</testProperty>
</properties>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM