为什么Eclipse / Maven项目没有从settings.xml中获取值?

时间:2011-11-24 11:50:40

标签: eclipse maven

我已将配置保存在c:\ users \ username \ .m2 \ settings.xml的底部,但是作为Eclipse中Maven Project的一部分创建的pom.xml没有获取值。有效的POM仍然有

  <repositories>  
    <repository>  
      <snapshots>  
        <enabled>false</enabled>  
      </snapshots>  
      <id>central</id>  
      <name>Maven Repository Switchboard</name>  
      <url>http://repo1.maven.org/maven2</url>  
    </repository>  
  </repositories>  

应该是http://ebr.springsource.com/respository相当于

  <pluginRepositories>  
    <pluginRepository>  
      <releases>  
        <updatePolicy>never</updatePolicy>  
      </releases>  
      <snapshots>  
        <enabled>false</enabled>  
      </snapshots>  
      <id>central</id>  
      <name>Maven Plugin Repository</name>  
      <url>http://repo1.maven.org/maven2</url>  
    </pluginRepository>  
  </pluginRepositories>  

的settings.xml

<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">  
  <repositories>  
      <repository>  
        <id>com.springsource.repository.bundles.release</id>  
        <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>  
        <url>http://repository.springsource.com/maven/bundles/release</url>  
      </repository>  

      <repository>  
        <id>com.springsource.repository.bundles.external</id>  
        <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>  
        <url>http://repository.springsource.com/maven/bundles/external</url>  
      </repository>  
  </repositories>  
</settings>  

1 个答案:

答案 0 :(得分:3)

您应该将其添加到执行mvn命令的用户的主文件夹

默认情况下,您正在查找settings.xml:

  • Maven安装:$ M2_HOME / conf / settings.xml
  • 用户的安装:$ {user.home} /.m2 / settings.xml