Maven配置问题 - settings.xml

时间:2017-11-21 17:54:55

标签: spring maven-2

成功从我的存储库中取出几个罐子。这个特殊的jar(失败,见下文)需要来自Maven central Repo,但是它看到从我的repo下载它,这个jar不存在。我觉得我在settings.xml中的配置是错误的。我的主要疑问是镜像配置。

  

找不到工件org.springframework.boot:spring-boot-starter-parent:pom:1.4.0.RELEASE in my domain http://w3.maven.mydomain.com/nexus/content/repositories/domain

<?xml version="1.0" encoding="UTF-8"?>
<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 
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<pluginGroups></pluginGroups>

<proxies></proxies>

<servers>
 <server>
        <id>myrepo</id>
        <username>myname</username>
        <password>****</password>
        <configuration></configuration>
    </server>
</servers>
<mirrors>
<mirror>
   <id>maven2</id>
   <name>maven2</name>
   <url>https://repo.maven.apache.org/maven2</url>
   <mirrorOf>maven</mirrorOf>
</mirror>   
  <mirror>
   <id>myrepo</id>
   <name>repo TPS</name>
   <url>http://w3.maven.mydomain.com/nexus/content/repositories/domain</url>
   <mirrorOf>central</mirrorOf>
 </mirror>
</mirrors>
<profiles></profiles>
</settings>

1 个答案:

答案 0 :(得分:1)

尝试在pom.xml中添加以下内容

<repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>