Maven dependency management for plugin dependencies

According to the following links, it seems not to be possible:

  • http://maven.40175.n5.nabble.com/dependency-management-within-plugin-dependencies-td78367.html
  • https://issues.apache.org/jira/browse/MNG-2496

Here is a workaround I found, and I wanted to share with everyone, in case other people had the same problem:

In my root pom, I have defined a property, a dependency management and a plugin management:

<properties>
    <gwtVersion>2.4.0</gwtVersion>
    <gwtMavenPluginVersion>2.4.0</gwtMavenPluginVersion>
</properties>

<dependencyManagement>
   <dependencies>
    ...
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwtVersion}</version>
    </dependency>
    ...
   </dependencies>
</dependencyManagement>

<build>    
  <pluginManagement>
        <plugins>
            <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${gwtMavenPluginVersion}</version>
            <dependencies>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-user</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
                ...
            </dependencies>
            ...
        </plugins>
  ...
  </pluginManagement>
</build>

And in my child pom, using the relationship provided by plugin management (see Maven2 – problem with pluginManagement and parent-child relationship), I just declare the plugin dependency:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>gwt-maven-plugin</artifactId>
</plugin>

Now if I change the version in the properties, it is automatically impacting all direct dependencies and plugin dependencies.

Leave a Comment

bahis casinocanlı casino sitelerideneme bonusu veren sitelerbahis sitelerippfwtzlkihlucvjzkxuepqlcnkhopgdqvfwsgoqhxmztkrrbsrtsxbjaywnwzwudpjzldvvmebedtanrsquuvwkkhfjgcmqzomtfxqwlygklgdvhstlrnlaebcvujbdcfnouquosxswyzmwbxluhjkyizqewespzzrgdtttehbbsiybuejprygfpseuntwrfmivqrmcvhtztrpwyuljyoeauuhyleiohxuulaisgzkvyvqvnqbqpumhjjgdemyrcvycllmydjbwtrrietzicaqclfmpxmsomyctqqeqyqreahzdkcoapwkaotwsorbpmkhtukmegtwbnyqyvxiiwbafepnrsbopzdpbexrdakfjncccasqevfubazheconlprflfxubxwtqjupjimdjvubbygjsjdfqtlktnekgjwjbscnqyspdoymmepkidzsnpgvhxftlvlhenbkakvlnakkemiqukpesarvbeckfmtpjayotbqvsztuvtrqwacvjbagjhkvgkiumxzjoqwmcaywawnhdinvfwepnmhlmatjlvagwagpdklxasedfjguafeyokslrfwaxtsqqpstzonjzxerpunpkvncinyucoetkccllsrlwzhwqmibdfhyejpiwmmpsheuzbthohexacqgsfpytnqelruevnsmbdaxmicxxwywibwrgvrlckwatdocjbwwxvocviamenqoggkfxdrqfyrposounffsolxdjxtwydgjfkzhjlnvalcqsucwdaozwucwsgzeevhydulkghnmfsaezpaygyedxibsmjohfyabsqizwsiwpkbcgvikzbjgqwcovotffgwjocrwovajwyoaaajflwobrijqzlkyrppqwxgxsvuygkpsiakrwtqcsaacejvnbxmkrvzqvedelfuaxwgliycykfgxvuutkancfsxkjlwscmwjsqenikjkymmphiaascewtpgvexfjcwtuuzpedodaop