【问题标题】:How change url local repository without root folder in POM.xml如何在 POM.xml 中更改没有根文件夹的 url 本地存储库
【发布时间】:2020-06-23 09:41:00
【问题描述】:

我的 Maven 项目有问题。在我的 pom.xml 文件中,我在我的项目中添加了存储库,但现在存储库的链接是静态的。我的问题是如何在不使用我的根文件夹的情况下更改 url 路径,所以当其他人拉我的项目时,他们不能先更改路径

<repositories>
    <repository>
        <id>local-maven-repo</id>
        <url>file:///D:/Coding-an/eclipse-workspace/TK_Rama_Automation/repository</url>
    </repository>
</repositories>

我预期的情况应该是这样的,但我不知道如何实现:

<repositories>
    <repository>
        <id>local-maven-repo</id>
        <url>file:///../TK_Rama_Automation/repository</url>
    </repository>
</repositories>

【问题讨论】:

  • 用属性指定它不适合您?调用 mvn -Dmaven.repo.local=../[path] 应该可以工作
  • @RobertoBenazzato 能给个参考吗?

标签: java maven pom.xml


【解决方案1】:

作为对您问题的更完整答案,您有两种方法可以实现您想要的:

  1. 您可以使用系统属性指定您的仓库,即运行mvn clean install -Dmaven.repo.local=../TK_Rama_Automation/repository

  2. 在你的设置部分直接指定它,你必须把标签localRepository,在官方页面查看maven configuration


    ...
    ../TK_Rama_Automation/repository
    ...
    设置>

【讨论】:

    猜你喜欢
    • 2018-10-17
    • 1970-01-01
    • 1970-01-01
    • 2014-06-05
    • 1970-01-01
    • 1970-01-01
    • 2012-05-01
    • 1970-01-01
    • 2014-10-20
    相关资源
    最近更新 更多