为什么jira尝试从不同来源下载依赖项

时间:2018-02-06 07:44:00

标签: maven jira artifactory

我有一个jira尝试从服务器下载依赖项。我有一个配置好的存储库,效果很好。此存储库复制来自服务器的数据(实际上它是一个安全的网关)。

但不知怎的,jira尝试直接连接到服务器,同时它引用了存储库:3 enter image description here

enter image description here 我认为在jira连接网络和互联网配置maven。也许我错了?

这里是mavena setting.xml的设置(atlassian-plugin-sdk-6.2.14 \ apache-maven-3.2.1 \ conf)

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <profiles>
    <profile>
      <repositories>
        <repository>
          <id>maven-public</id>
          <url>http://n7701-sys274:8081/artifactory/maven-public</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </repository>
        <repository>
         <id>maven-external</id>
          <url>http://n7701-sys274:8081/artifactory/maven-external</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </repository>
        <repository>
          <id>maven2</id>
          <url>http://n7701-sys274:8081/artifactory/maven2/</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </repository>
        <repository>
          <id>public</id>
          <url>http://n7701-sys274:8081/artifactory/public/</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>public</id>
          <url>http://n7701-sys274:8081/artifactory/public/</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </pluginRepository>
        <pluginRepository>
          <id>maven2</id>
          <url>http://n7701-sys274:8081/artifactory/maven2/</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </pluginRepository>
        <pluginRepository>
          <id>maven-external</id>
          <url>http://n7701-sys274:8081/artifactory/maven-external</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </pluginRepository>
        <pluginRepository>
          <id>maven-public</id>
          <url>http://n7701-sys274:8081/artifactory/maven-public</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings> 

1 个答案:

答案 0 :(得分:0)

除非我弄错了,否则你的问题是:

  • 您正确配置maven以从神器服务器检索工件
  • maven从artifactory下载一批工件并解析它们
  • maven然后尝试从maven central
  • 下载传递依赖项

Maven central是一个特殊的预配置存储库,通过automatic POM inheritance注入。 因此,您的工件在您自己的settings.xml和maven central

中定义的存储库中得到解决

简而言之,您需要在 settings.xml 中定义您的artifactory服务器充当maven central的镜像,并使用以下代码段

  ...
  <mirrors>
    <mirror>
      <id>central-proxy</id>
      <name>Artifactory proxy of central repo</name>
      <url>http://n7701-sys274:8081/artifactory/maven-public</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  ...

请注意,与此问题密切相关的是Disable Maven central repository 我的答案是这个问题的解决方案的组合。