简体   繁体   English

Maven:settings.xml中的存储库

[英]Maven: Repositories in settings.xml

I have following .m2/settings.xml : 我有以下.m2/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
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <repositories>

        <repository>
          <id>jboss-ga-repository</id>
          <url>http://maven.repository.redhat.com/techpreview/all</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>

      </repositories>
      <pluginRepositories>

        <pluginRepository>
          <id>jboss-ga-plugin-repository</id>
          <url>http://maven.repository.redhat.com/techpreview/all</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>

      </pluginRepositories>
    </profile>
  </profiles>
</settings>

When I try run mvn install against my project it says: 当我尝试对我的项目运行mvn install ,它说:

[INFO] Unable to find resource 'org.jboss.bom.eap:jboss-javaee-6.0-with-tools:pom:6.4.0.GA' in repository central (https://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.jboss.bom.eap:jboss-javaee-6.0-with-tools

Reason: POM 'org.jboss.bom.eap:jboss-javaee-6.0-with-tools' not found in repository: Unable to download the artifact from any repository

  org.jboss.bom.eap:jboss-javaee-6.0-with-tools:pom:6.4.0.GA

from the specified remote repositories:
  central (https://repo1.maven.org/maven2)

 for project org.jboss.bom.eap:jboss-javaee-6.0-with-tools

But it tried only central (https://repo1.maven.org/maven2) . 但是它只尝试了central (https://repo1.maven.org/maven2) Why did it ignore repositories specified in settings.xml ? 为什么它忽略settings.xml指定的存储库?

Profiles need to be activated in your Maven build. 必须在您的Maven构建中激活配置文件。 There are several ways to activate them (see http://maven.apache.org/guides/introduction/introduction-to-profiles.html ). 有多种激活它们的方法(请参阅http://maven.apache.org/guides/introduction/introduction-to-profiles.html )。 For example, you can activate it at the command line using: 例如,您可以使用以下命令在命令行中将其激活:

mvn ... -Pprofile-1

But obviously you'll need to declare the profile ID in the <profile> node that you showed. 但是显然,您需要在显示的<profile>节点中声明配置文件ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM