Maven dependency management for plugin dependencies

前端 未结 4 1593
天涯浪人
天涯浪人 2020-12-13 23:14

Recently, I came accross the following problem :

As I set up dependency management for my project, I had child-pom using plugin with dependencies, that I want to be

4条回答
  •  粉色の甜心
    2020-12-14 00:13

    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 :

    
        2.4.0
        2.4.0
    
    
    
       
        ...
        
            com.google.gwt
            gwt-user
            ${gwtVersion}
        
        ...
       
    
    
        
      
            
                
                org.codehaus.mojo
                gwt-maven-plugin
                ${gwtMavenPluginVersion}
                
                    
                        com.google.gwt
                        gwt-user
                        ${gwtVersion}
                    
                    ...
                
                ...
            
      ...
      
    
    

    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 :

    
       org.codehaus.mojo
       gwt-maven-plugin
    
    

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

提交回复
热议问题