16

我在eclipse中使用maven(m2 eclipse)

当我执行 mvn:install 时,我希望将我的 jar(工件)安装在位于服务器上的 nexus 存储库中(现在安装的 jar 被放置在本地系统存储库中).. 我该怎么做?

在此处输入图像描述

我什至将其更改为我的本地存储库地址

4

1 回答 1

25

通常,您将mvn deploy用于部署到非本地存储库。

当然,您需要在 maven settings.xml 或项目 POM 中配置 repo。

由于我们总是使用相同的内部存储库,我在 Maven settings.xml 中完成了这项工作,更准确地说,是“配置文件”部分。

这是我的配置供参考:

  <profiles>
    <profile>
      <id>artifactory</id>
      <repositories>
        <repository>
          <id>central</id>
          <name>libs-releases</name>
          <url>http://repo.example.com/libs-releases</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>snapshots</id>
          <name>libs-snapshots</name>
          <url>http://repo.example.com/libs-snapshots</url>
          <snapshots />
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <name>plugins-releases</name>
          <url>http://repo.example.com/plugins-releases</url>
          <snapshots><enabled>false</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
于 2011-02-25T12:15:24.677 回答