部署到maven时,上传永远挂起

问题描述 投票:0回答:8

我正在将一个库部署到我的远程 Maven 存储库。

当我运行

mvn -U deploy
或简单地
mvn deploy
上传工件时,一切看起来都很好。它只是挂在那里永远

就像这样:

Uploading: http://maven.mycompany.com/server-product/com/mycompany/product/server/common/Common/3.0/Common-3.0.jar
213/213 KB 

我读过herehereherehere,但它们都与下载有关,而不是上传。我可以很好地下载,但上传我的工件却挂起。这些链接与以前的 Maven 版本上的一些错误有关,我正在使用

Apache Maven 3.3.3

远程服务器正在运行

Artifactory 3.6.0 (rev. 30178)

有谁知道问题出在哪里吗?我做错了什么?

这是我的settings.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>admin</username>
      <password>superSecretPassword</password>
      <id>central</id>
    </server>
    <server>
      <id>myCompany Maven</id>
      <username>admin</username>
      <password>superSecretPassword</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://maven.myCompany.com/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://maven.myCompany.com/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://maven.myCompany.com/plugins-release</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

这是我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.myCompany.product.server.common</groupId>
    <artifactId>Common</artifactId>
    <version>3.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        (dependencies...)
    </dependencies>

    <distributionManagement>
        <repository>
            <id>myCompany Maven</id>
            <name>myCompany Maven-releases</name>
            <url>http://maven.myCompany.com/server-product</url>
        </repository>
    </distributionManagement>

</project>

这是

mvn deploy

的输出
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Common 3.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Common ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/dwnz/Development/Server/code/product/Common/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Common ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Common ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Common ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Common ---
[INFO] Installing /Users/dwnz/Development/Server/code/product/Common/target/Common-3.0.jar to /Users/dwnz/.m2/repository/com/mycompany/product/server/common/Common/3.0/Common-3.0.jar
[INFO] Installing /Users/dwnz/Development/Server/code/product/Common/pom.xml to /Users/dwnz/.m2/repository/com/mycompany/product/server/common/Common/3.0/Common-3.0.pom
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ Common ---
Uploading: http://maven.mycompany.com/server-product/com/mycompany/product/server/common/Common/3.0/Common-3.0.jar
213/213 KB  ---->> Here it hangs *forever*!
maven deployment artifactory maven-release-plugin
8个回答
3
投票

我也有类似的问题。

mvn deploy
几乎会完成上传,然后就会挂起。结果问题出在我的凭据上。


0
投票

我也遇到了类似的问题,就在执行

release:perform
时。上传的时候卡住了。我的解决方案是添加一个插件,更改构建部分中的一些版本和一个 groupId:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.7</version>
                <dependencies>
                    <dependency>
                        <groupId>com.google.code.maven-svn-wagon</groupId>
                        <artifactId>maven-svn-wagon</artifactId>
                        <version>1.4</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.jvnet.wagon-svn</groupId>
                        <artifactId>wagon-svn</artifactId>
                        <version>1.12</version>
                    </dependency>
                </dependencies>
            </plugin>

0
投票

我也遇到了类似的问题,解决方案是在服务器路径中添加“artifactory”。跟踪实际的 HTTP 流量后,我可以看到,对于下载,服务器正确地从 Maven 重定向 http://maven.myCompany.com/libs-releasehttp://maven.myCompany.com/artifactory/libs-release 但对于上传,此重定向不起作用

所以我的答案是更改我的 pom 以包含正确的路径并避免重定向:

<distributionManagement>
    <repository>
        <id>myCompany Maven</id>
        <name>myCompany Maven-releases</name>
        <url>http://maven.myCompany.com/artifactory/lib-snapshot-local</url>
    </repository>
</distributionManagement>

0
投票

就我而言,我注意到当系统从远程存储库下载一个预先存在的小文件时,部署过程挂起,并且似乎字节计数不正确(例如报告已下载“1009/1008 字节”)。当人们从不同的操作系统环境进行部署时,这种情况似乎偶尔会发生。毫无疑问,我解决这个问题的不太理想的方法是登录到远程存储库并删除有问题的文件;当我下次尝试部署相同的项目时,这似乎解决了问题。


0
投票

对我来说,将其添加到构建/插件中的 POM 中是关键的一步:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.2</version>
    <dependencies>

        <dependency>
            <!-- on its own, this very old plugin seems to include very old versions 
                of wagon-ssh, jsch and svnkit -->
            <groupId>com.google.code.maven-svn-wagon</groupId>
            <artifactId>maven-svn-wagon</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>2.10</version>
        </dependency>

        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.53</version>
        </dependency>

        <dependency>
            <groupId>org.tmatesoft.svnkit</groupId>
            <artifactId>svnkit</artifactId>
            <version>1.8.12</version>
        </dependency>

    </dependencies>
</plugin>

0
投票

当后备数据库是 mysql 并且它存储二进制日志的分区空间不足时,就发生了这种情况。 Mysql 挂起,导致 arifactory 在上传过程中挂起。释放该分区上的一些空间立即解决了问题。


0
投票

尝试使用 https 而不是 http

设置存储库 url

-1
投票

就我而言,解决方案非常简单,然而,我花了四五天的时间才发现它,等待 4 分钟/部署.....问题是....... ....防病毒! ...将其关闭,瞧,20 秒/部署。

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.