How to configure maven local and remote repository in gradle build file?

后端 未结 2 623
陌清茗
陌清茗 2020-12-08 11:07

i want to use the maven local repository additionally to a maven remote one. I found the JIRA-Issue http://issues.gradle.org/browse/GRADLE-1173 for that, but adapting my gra

相关标签:
2条回答
  • 2020-12-08 11:15

    Maven can only use a single local ("local" = on the harddisk of the computer on which Maven runs) repository.

    If you need more, you're options are:

    • Run a remote server (like a company wide proxy) and deploy everything there. Put that server as a mirror into your settings.xml.
    • Run mvn install to copy the artifacts in your local repo (obviously only when you do have the sources)
    • Run a local server
    • Copy the artifacts manually into your local repo
    0 讨论(0)
  • 2020-12-08 11:19

    I also needed to do a similar setup with my project and I can verify your build.gradle setup works provided your Maven is setup correctly.

    Gradle's mavenLocal() relies on the localRepository definition from the maven settings.xml file:

      <localRepository>USER_HOME\.m2\repository</localRepository>
    

    The settings.xml should be in either your M2_HOME/conf or your USER_HOME/.m2 directory. You should check:

    1. maven is installed correctly
    2. M2_HOME environment variable exists
    3. settings.xml has the correct localRepository defined..
    0 讨论(0)
提交回复
热议问题