从Eclipse将工件部署到Nexus期间发生错误 [英] Error during deployment of artifacts to Nexus from Eclipse

查看:218
本文介绍了从Eclipse将工件部署到Nexus期间发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的服务器上安装了Nexus,并设置了快照和发布存储库.

Installed Nexus on our server and set up a snapshot and a releases repositories.

在子模块maven项目中更改了顶层项目的pom.xml文件,并添加了以下几行:

Altered my pom.xml file of the top project in my sub-module maven project, added these lines:

  <distributionManagement>
    <snapshotRepository>
        <id>Snapshots</id>
        <url>http://maven:8081/nexus/content/repositories/Snapshots</url>
    </snapshotRepository>
    <repository>
        <id>Releases</id>
        <url>http://maven:8081/nexus/content/repositories/Releases</url>
    </repository>
  </distributionManagement>

我已将.settings.xml添加到.m2目录,其中包含以下内容:

I've added a settings.xml to .m2 directory with the following contents:

<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">
    <!--
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  -->
  <servers>

    <server>
      <id>Snapshots</id>
      <username>user</username>
      <password>pass</password>

      <privateKey>${user.home}/.ssh/id_dsa</privateKey>
      <passphrase>some_passphrase</passphrase>

      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
      <configuration></configuration>

    </server>

  </servers>
  <!--
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
  -->
</settings>

当我在顶级项目上运行具有eclipse部署目标的maven时,maven开始构建并同步(上传)到快照存储库.顶部的项目被上传,但是在第一个子模块构建并开始同步之后,我不断得到:

When I run maven with deploy goal from eclipse on my top project, maven starts to build and syncing (uploading) to the snapshots repo. The top project gets uploaded but after the first sub module is built and started to sync I keep getting:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project <my sub module project>: Failed to deploy artifacts: Could not transfer artifact <group id>:<artifact id>:xml:0.0.1-20130318.160312-21 from/to Snapshots (http://maven:8081/nexus/content/repositories/Snapshots): Remotely Closed [id: 0x017ae341, /192.168.10.237:58758 :> maven/192.168.10.36:8081]

奇怪的是,如果我从Nexus界面浏览我的仓库,则子项目在那里有xml和jar等等.但是问题是由于错误,Maven停止了并且我的所有其他子项目都没有部署.

The weird thing is that if I browse my repo from Nexus interface the sub project is there with xml's and jar's etc. Problem though is that because of the error maven stops and all my other sub projects isn't deployed.

有人知道如何解决这个问题吗?

Anyone know how to resolve this?

更新: 如果我创建一个带有distributionManagement-tag的maven项目,则可以毫无问题地部署到Nexus.但是当有多个Maven项目时,我得到了错误.我尝试将distributionManagement添加到child-pom,但是出现相同的错误.

UPDATE: If I create a single maven project with distributionManagement-tag I can deploy without problems to Nexus. But when having multi maven project I get the error. I tried to add distributionManagement to child-pom to but I get the same error.

将poms部署到与distributionManagement标签有关的存储库中应该如何?

How should the poms look like en deploying to a repository regarding distributionManagement tag ?

推荐答案

经过几个小时的调查,我发现了我的问题. 我的父pom.xml中有一个部分,将一个features.xml添加到父仓库中.

After some hours investigation I found my problem. I have a section in my parent pom.xml that adds a features.xml to parent repo.

<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>${maven-resources-plugin.version}</version>
              <executions>
                 <execution>
                    <id>filter</id>
                    <phase>generate-resources</phase>
                    <goals>
                      <goal>resources</goal>
                    </goals>
                 </execution>
              </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/features.xml</file>
                                    <type>xml</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
         </plugins>
   </build>

此问题导致远程关闭"问题.

This one caused the "Remotely closed" issue.

这篇关于从Eclipse将工件部署到Nexus期间发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆