我在父pom.xml和子pom.xml中定义了配置文件,但是当我尝试从父项目运行mvn install -P profile name
时,配置文件中定义的属性未被复制
My Parent pom.xml如下所示:
<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>
我的孩子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>
答案 0 :(得分:1)
你需要从孩子那里引用你的父母:
<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>