Can I add maven repositories in the command line?

后端 未结 7 1793
小鲜肉
小鲜肉 2020-12-07 19:52

I\'m aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:



        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 20:23

    I am not sure if you can do it using the command line. You can on the other hand add repositories in the pom.xml as in the following example. Using this approach you do not need to change the ~/.m2/settings.xml file.

        
        
        ...
        
                
                    MavenCentral
                    Maven repository
                    http://repo1.maven.org/maven2
                    
                        true
                    
                    
                        false
                    
                
    ...
                
                    Codehaus Snapshots
                    http://snapshots.repository.codehaus.org/
                    
                        true
                    
                    
                        false
                    
                
            
    
        ...
    
            
                
                    apache.snapshots
                    Apache Snapshot Repository
                    
                        http://people.apache.org/repo/m2-snapshot-repository
                    
                    
                        false
                    
                
                
                    Codehaus Snapshots
                    http://snapshots.repository.codehaus.org/
                    
                        true
                    
                    
                        false
                    
                
            
    
        ...
    
        
    

提交回复
热议问题