Maven无法从自定义存储库中下载依赖项

时间:2018-10-04 10:18:46

标签: maven github

我试图通过maven将其作为依赖项加载,从而在两个项目之间共享一些代码。由于某些原因,我无法让Maven来获取依赖关系。

这是我生成共享JAR的方式:

mvn install:install-file -Dfile=/Users/usr1/shared-code-1.0.0.jar -DpomFile=/Users/usr1/shared-code/pom.xml -DlocalRepositoryPath=.

此罐子保存在git repo github.com/myOrg/myRepo/repository中,其中repository是分支。 pom文件中针对共享代码描述的配置如下所示:

<groupId>com.myOrg</groupId>
<artifactId>shared-code</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

这是我在其他代码库中定义依赖项和存储库的方式:

    <dependency>
        <groupId>com.myOrg</groupId>
        <artifactId>shared-code</artifactId>
        <version>1.0.0</version>
    </dependency>

    ...
    ...

    <repository>
        <id>shared-code/id>
        <name>Shared code for my stuff</name>
        <url>http://raw.github.com/myOrg/myRepo/repository</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>\

尝试执行mvn clean package时遇到的确切错误是:

[ERROR] Failed to execute goal on project otherCodeBase: Could not resolve dependencies for project otherCode:myProject:jar:latest: Failure to find com.myOrg:shared-code:jar:1.0.0 in http://[company's artifactory repo] was cached in the local repository, resolution will not be reattempted until the update interval of artifactory has elapsed or updates are forced -> [Help 1]

乍看之下,看起来Maven甚至没有扫描我在其他代码的pom文件中定义的存储库,但是当我执行mvn help:effective-pom时,它确实出现了。我还应该补充一点,我确实将此存储库公开,以使其能够工作一次。有什么作用?

0 个答案:

没有答案