Is there anyway to exclude artifacts inherited from a parent POM?

后端 未结 9 1227
礼貌的吻别
礼貌的吻别 2020-11-30 22:02

Artifacts from dependencies can be excluded by declaring an element inside a But in this case it\'s needed to

9条回答
  •  无人及你
    2020-11-30 22:32

    You can group your dependencies within a different project with packaging pom as described by Sonatypes Best Practices:

    
        4.0.0
        base-dependencies
        es.uniovi.innova
        1.0.0
        pom
        
            
                javax.mail
                mail
                1.4
            
        
    
    

    and reference them from your parent-pom (watch the dependency pom):

    
        4.0.0
        base
        es.uniovi.innova
        1.0.0
        pom
        
            
                base-dependencies
                es.uniovi.innova
                1.0.0
                pom
            
        
    
    

    Your child-project inherits this parent-pom as before. But now, the mail dependency can be excluded in the child-project within the dependencyManagement block:

    
        4.0.0
        test
        jruby
        0.0.1-SNAPSHOT
        
            base
            es.uniovi.innova
            1.0.0
        
    
        
            
                
                    base-dependencies
                    es.uniovi.innova
                    1.0.0
                    
                        
                            javax.mail
                            mail
                        
                    
                
            
        
    
    

提交回复
热议问题