Is there a way to update default-bindings.xml for maven on local

前端 未结 2 721
青春惊慌失措
青春惊慌失措 2021-01-16 08:52

It could sound dumb. But is there a way to edit or update the default-bindings file of maven?

/META-INF/plexus/default-bindings.xml

2条回答
  •  粉色の甜心
    2021-01-16 09:15

    Looks like you want to override the version the override the version of maven-surefire-plugin wihtout modifying any project' specific pom.xml file . To achieve this you need to extend your local installation of maven. Maven have concept of super pom and pom (without parent) is extended from it implicitly.

    Since you neither have parent pom nor want to modify all of project's pom, only option left seems to override the default super pom. I am not sure if overriding binding can help too or not. But you should be able to override the super pom by following steps to meet your needs.

    1) Create a super pom file (pom-4.0.0.xml) by copying the default pom file (directory content for maven 3.x version):

    \---org
        \---apache
            \---maven
                \---model
                        pom-4.0.0.xml 
    

    2) Add entry for maven-surefire-plugin with required version as shown in sniped below.

     ...
    
     ...
     
      
        maven-surefire-plugin
        2.19
       
      
    
    ...
    

    3) Create a jar, say mycompany.superpom.jar packaging your pom file.

    jar -cf mycompany.superpom.jar .
    

    4) Place the jar under $MAVEN_HOME\lib\ext directory.

    5) You should be done. All your project will be using maven-surefire-plugin with specified version.

    Hope this helps.

提交回复
热议问题