将插件移到父pom

时间:2019-03-21 06:00:00

标签: java maven pom.xml parent-pom

我有两个子pom和一个父pom,我将公共依赖项移到了父级,并且在成功建立了相对路径后,现在我将公共插件移到了父pom,这给我抛出了一个错误,这是父pom的代码段

<build>
    <plugins>
     <plugin>
    <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${dependency.plugin.version}</version>
                <executions>
                   <execution>
                      <id>copy-test-license</id>
                      <goals>
                         <goal>copy</goal>
                      </goals>
                      <phase>process-test-resources</phase>
                      <configuration>
                         <artifactItems>
                            <artifactItem>
                               <groupId>com.cerner.clover</groupId>
                               <artifactId>clover</artifactId>
                               <version>${clover.license.version}</version>
                               <type>license</type>
                            </artifactItem>
                         </artifactItems>
                         <outputDirectory>${project.build.directory}</outputDirectory>
                         <stripVersion>true</stripVersion>
                      </configuration>
                   </execution>
                   <execution>
                      <id>copy-pre-site-license</id>
                      <goals>
                         <goal>copy</goal>
                      </goals>
                      <phase>pre-site</phase>
                      <configuration>
                         <artifactItems>
                            <artifactItem>
                               <groupId>com.cerner.clover</groupId>
                               <artifactId>clover</artifactId>
                               <version>${clover.license.version}</version>
                               <type>license</type>
                            </artifactItem>
                         </artifactItems>
                         <outputDirectory>${project.build.directory}</outputDirectory>
                         <stripVersion>true</stripVersion>
                      </configuration>
                   </execution>
                </executions>
             </plugin>
    </plugins>
   </build>

错误是:

build.plugins.plugin.version' for org.apache.maven.plugins:maven-dependency-plugin must be a valid version but is '${dependency.plugin.version}'.

我知道由于未提及版本而造成了问题。该如何解决?

1 个答案:

答案 0 :(得分:2)

检查父pom中是否有类似的内容:

<properties>
...
   <dependency.plugin.version>your-plugin-version</dependency.plugin.version>
...
</properties>