小编Kob*_*kis的帖子

Artifactory中的依赖关系解析配置

最近我们开始使用Artifactory.我们将settings.xml配置为Artifactory建议.但是,在运行"mvn compile"时我们在下载jar时遇到问题,即使它们出现在Artifactory repo中.显式添加repo1-cache解决了编译问题,但是从远程存储库而不是Artifactory执行下载.

<repository>
    <id>My Repository</id>
    <name>MyRepository-releases</name>
    <url>http://mvn-srv:8081/artifactory/repo1</url>
</repository>
Run Code Online (Sandbox Code Playgroud)

应该添加到settings.xml中以自动解决依赖关系并从工件中获取它们而不是每次访问远程服务器?

settings.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<settings
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
    <profile>
        <repositories>
            <repository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>central</id>
                <name>libs-release</name>
                <url>http://mvn-srv:8081/artifactory/libs-release</url>
            </repository>
            <repository>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <id>snapshots</id>
                <name>libs-snapshot</name>
                <url>http://mvn-srv:8081/artifactory/libs-snapshot</url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>central</id>
                <name>plugins-release</name>
                <url>http://mvn-srv:8081/artifactory/plugins-release</url>
            </pluginRepository>
            <pluginRepository>
                <snapshots />
                <id>snapshots</id>
                <name>plugins-snapshot</name>
                <url>http://mvn-srv:8081/artifactory/plugins-snapshot</url>
            </pluginRepository>
        </pluginRepositories>
        <id>artifactory</id>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>artifactory</activeProfile>
</activeProfiles>
<servers>
    <server>
        <id>MyRepository</id>
    </server>
</servers>
Run Code Online (Sandbox Code Playgroud)

编译错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.355s
[INFO] Finished at: …
Run Code Online (Sandbox Code Playgroud)

dependencies artifactory pom.xml maven

11
推荐指数
2
解决办法
8925
查看次数

标签 统计

artifactory ×1

dependencies ×1

maven ×1

pom.xml ×1