On 30 January 2012 20:09, Shane StClair <[email protected]> wrote:
> Hello all,
>
> I have a project with a parent pom and child modules. Configuration
> properties are kept in a build.properties file and an overriding
> custom.build.properties. The properties-maven-plugin is defined in the

You are off the reservation there already.

That plugin is against the Maven design, at least as far as property
inheritance is concerned, only bugs in Maven 2 may have let you away
with that for now.

> parent pom to load these properties, and the plugin is inherited by the
> child poms. Property substitution based on these files is used directly in
> the parent and child poms and also for resource filtering.
>
> One child pom has a deploy profile using the cargo-maven2-plugin. In Maven
> 2, property substitution works everywhere using this methodology. In Maven
> 3, it works everywhere except inside of the child pom's deploy profile. In
> this case the substitution tokens are never replaced.
>
> Parent:
> <project>
>    ...
>    <modules>
>        <module>child-module</module>
>    </modules>
>
>    <properties>
>        <main.basedir>${project.basedir}</main.basedir>
>    </properties>
>    ...
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>properties-maven-plugin</artifactId>
>                <version>1.0-alpha-2</version>
>                <inherited>true</inherited>
>                <executions>
>                    <execution>
>                        <phase>initialize</phase>
>                        <goals>
>                            <goal>read-project-properties</goal>
>                        </goals>
>                        <configuration>
>                            <files>
>
> <file>${main.basedir}/build.properties</file>
>
> <file>${main.basedir}/custom.build.properties</file>
>                            </files>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>            ...
>        </plugins>
>    </build>
>    ...
> </project>
>
> Child:
> <project>
>    <parent>
>        <groupId>the.group</groupId>
>        <artifactId>the-parent</artifactId>
>        <version>0.1-SNAPSHOT</version>
>    </parent>
>    <modelVersion>4.0.0</modelVersion>
>    <artifactId>child-module</artifactId>
>    <packaging>war</packaging>
>
>    <properties>
>        <main.basedir>${project.parent.basedir}</main.basedir>
>    </properties>
>
>    <build>
>        <finalName>${final.name}</finalName>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-war-plugin</artifactId>
>                <version>2.1.1</version>
>                <configuration>
>
> <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
>                    <webResources>
>                        <resource>
>                            <directory>src/main/webapp</directory>
>                            <filtering>true</filtering>
>                        </resource>
>                        <resource>
>                            <directory>src/main/webapp/WEB-INF</directory>
>                            <filtering>true</filtering>
>                            <targetPath>WEB-INF</targetPath>
>                        </resource>
>                    </webResources>
>                </configuration>
>            </plugin>
>        </plugins>
>    </build>
>
>    <profiles>
>        <profile>
>            <id>deploy</id>
>            <build>
>                <finalName>${final.name}</finalName>
>                <plugins>
>                    <plugin>
>                        <groupId>org.codehaus.cargo</groupId>
>                        <artifactId>cargo-maven2-plugin</artifactId>
>                        <executions>
>                            <execution>
>                                <id>deploy-exec</id>
>                                <phase>install</phase>
>                                <goals>
>                                    <goal>deployer-undeploy</goal>
>                                    <goal>deployer-deploy</goal>
>                                </goals>
>                            </execution>
>                        </executions>
>
>                        <configuration>
>                            <container>
>
> <containerId>${deploy.tomcat.version}</containerId>
>                                <type>remote</type>
>                            </container>
>
>                            <configuration>
>                                <type>runtime</type>
>                                <properties>
>                                    <cargo.tomcat.manager.url>
>                                        ${deploy.tomcat.manager.url}
>                                    </cargo.tomcat.manager.url>
>                                    <cargo.remote.username>
>                                        ${deploy.tomcat.manager.username}
>                                    </cargo.remote.username>
>                                    <cargo.remote.password>
>                                        ${deploy.tomcat.manager.password}
>                                    </cargo.remote.password>
>                                </properties>
>                            </configuration>
>
>                            <!-- Deployer and Deployables configuration -->
>                            <deployer>
>                                <type>remote</type>
>                                <deployables>
>                                    <deployable>
>
> <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                        <type>war</type>
>                                    </deployable>
>                                </deployables>
>                            </deployer>
>                        </configuration>
>                    </plugin>
>                </plugins>
>            </build>
>        </profile>
>    </profiles>
> </project>
>
> In Maven 2, final.name and all deployment configuration properties are
> substituted according to the contents of the properties files. In Maven 3,
> they aren't substituted and deployment fails. Is this expected?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to