user665837
user665837

Reputation: 345

Maven Pom Parent Child Profile issues

I have profiles defined in the parent pom.xml and child pom.xml but when I try to run mvn install -P profile name from the parent project, the properties defined in the profile file are not being copied

My Parent pom.xml looks like:

            <dependencies>
              <dependency>
              <groupId>xxx</groupId> 
              <artifactId>xxx</artifactId> 
              <version>0.0.1-SNAPSHOT</version>
              <type>pom</type>
            </dependency>
            </dependencies>

            <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
            <execution>
            <id>copy-resources</id>
            <phase>verify</phase>
                <goals>
                <goal>copy-resources</goal>
                </goals>
            <configuration>
                <outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>                               <resources>
            <resource>
            <directory>deployment/${environment}</directory>
            </resource>
            </resources>
            </configuration>
            </execution>
            </plugin>

My child pom.xml:

        <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
        <execution>
        <id>copy-resources</id>
        <phase>verify</phase>
            <goals>
            <goal>copy-resources</goal>
            </goals>

        </execution>
        </plugin>

Upvotes: 0

Views: 884

Answers (1)

Wim Deblauwe
Wim Deblauwe

Reputation: 26878

You need to refer to your parent from the child:

<parent>
    <groupId>org.company.groupid</groupId>
     <!-- Artifact id of the parent here -->
    <artifactId>parentArtifactId</artifactId>
     <!-- Version of the parent here -->
    <version>1.0-SNAPSHOT</version>
</parent>

Upvotes: 1

Related Questions