如何将Apache Archiva设置为我所有maven项目的缓存?

时间:2017-01-02 11:37:37

标签: java spring apache maven archiva

我已经在

设置了内部回购的Apache Archiva

http://localhost:8080/archiva/repository/internal/

但是当我尝试运行" mvn compile"时,工件请求被转发到Apache Archiva,但我看到以下错误:

无法解析的父POM:找不到工件org.springframework.cloud:spring-cloud-build:pom:1.2.0.BUILD-SNAPSHOT和' parent.relativePath'没有本地POM @第13行,第10列 - > [帮助2]

我是否需要更新任何特定设置,以便Archiva可以从远程存储库中获取所需的工件?

来自〜/ .m2 / settings.xml的内容

<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0  https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>${user.home}/.m2/repository</localRepository>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors>
    <mirror>
      <id>internal</id>
      <name>Internal repo + cache </name>
      <url>http://localhost:8080/archiva/repository/internal/</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  <proxies/>
  <profiles>
      <profile>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
              <id>internal</id>
              <name>Archiva Managed Internal Repository</name>
              <url>http://localhost:8080/archiva/repository/internal/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </repository>
            <repository>
              <id>snapshots</id>
              <name>Archiva Managed Internal Repository</name>
              <url>http://localhost:8080/archiva/repository/snapshots/</url>
              <releases>
                <enabled>false</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
        </repositories>
    </profile>
  </profiles>
  <activeProfiles/>
</settings>

1 个答案:

答案 0 :(得分:0)

As long as I know archiva comes with the default configuration to search artifacts in maven central repo. As maven central does not contain SNAPSHOT versions of artifacts, you cannot fetch it from there.

Try to address a release version instead of SNAPSHOT.