Can I add maven repositories in the command line?

后端 未结 7 1782
小鲜肉
小鲜肉 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条回答
  •  既然无缘
    2020-12-07 20:45

    You can do this but you're probably better off doing it in the POM as others have said.

    On the command line you can specify a property for the local repository, and another repository for the remote repositories. The remote repository will have all default settings though

    The example below specifies two remote repositories and a custom local repository.

    mvn package -Dmaven.repo.remote=http://www.ibiblio.org/maven/,http://myrepo 
      -Dmaven.repo.local="c:\test\repo"
    

提交回复
热议问题