How to get the Maven local repo location?

前端 未结 7 2019
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 08:26

Is there a way to get the Maven local repo location?

Using the following command you can force Maven to use a specific setting file:

 mvn -s < pat         


        
7条回答
  •  鱼传尺愫
    2020-12-04 09:09

    If you want just the local repo, try this:

    mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]'
    

    EDIT

    I'm revisiting this after years because recent versions of the Maven help plugin introduced a useful parameter for the evaluate goal called forceStdout that allows us to remove the need to grep the output:

    mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout
    

提交回复
热议问题