Search code examples
javamavenpom.xmlparent-pom

Moving plugins to parent pom


I have two child pom and 1 parent pom,I moved common dependencies to parent and after setting up relative path build succeeded and now I moved common plugins to parent pom and it's throwing me an error,here's the code snippet for parent 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>

The error is:

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

I understood that problem is created due to not mentioning version. How to solve this?


Solution

  • Check if you have something like this in your parent pom:

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