开发者

maven super pom's profile properties inheritance at child poms

at my project there is 2 profiles and each profile has one property. But I could not use master's properties at child's resources.

Here is described clearly but it seems that there is only one pom file and the sample shown at there is not an multi-module maven project.

All I want to do is use this properties at spring level like changing the location of properties file.

 <profile>
        <id>p1</id>
        <properties>
            <properties.location>file:/apps-core1.properties</properties.location>
        </proper开发者_开发知识库ties>
    </profile>
 <profile>

 <profile>
        <id>p2</id>
        <properties>
            <properties.location>file:/apps-core2.properties</properties.location>
        </properties>
    </profile>
 <profile>

and I want to use "properties.location" at every pom file I had, either main-resources or test-resources.

here is the spring usage

<context:property-placeholder location="\${properties.location}" />


i got it working with a multi-module project with:

  • parent pom with <modules /> config and your profiles
  • module pom with following config

    <build>
       <resources>
          <resource>
             <directory>src/main/resources</directory>
             <filtering>true</filtering>
             <includes>
                <include>**/*.xml</include>
             </includes>                
          </resource>
       </resources>
    </build>
    

see maven resources and filtering

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜