dazito
dazito

Reputation: 7980

When deploying to maven the upload hangs forever

I'm deploying a library to my remote maven repository.

when I run mvn -U deploy or simply mvn deploy everything looks fine apart when uploading the artifact. It just hangs in there forever.

Just like this:

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

I've read here, here, here and here but they are all related to downloading, not uploading. I can download just fine, but uploading my artifact it just hangs. Those links are related to some bug on previous maven versions, I'm using Apache Maven 3.3.3

The remote server is running Artifactory 3.6.0 (rev. 30178)

Anyone know where is the problem? What am I doing wrong?

Here is my settings.xml file:

<?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>

Here's my 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>

And here is the ouput from 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*!

Upvotes: 4

Views: 5665

Answers (8)

user24911214
user24911214

Reputation: 1

Try set repository url use https instead of http

Upvotes: 0

M&#225;rio Morais
M&#225;rio Morais

Reputation: 1

In my case the solution was ridiculously simple, nevertheless, taked me four or five days to discover it, waiting 4 min / deploy ..... The problem was ....... .... AntiVirus !!! ... Turned it off and, voila, 20 seconds/deploy.

Thanks

Upvotes: -1

Paul Calabro
Paul Calabro

Reputation: 1906

I had a similar problem. mvn deploy would almost finish uploading and then it would just hang. The issue turned out to be my credentials.

Upvotes: 3

Wesley Hartford
Wesley Hartford

Reputation: 426

This happened to me when the backing database was mysql and the partition that it was storing its binary logs to ran out of space. Mysql hang, causing arifactory to hang during an upload. Freeing up some space on that partition immediately resolved the issue.

Upvotes: 0

Dr. Max V&#246;lkel
Dr. Max V&#246;lkel

Reputation: 1859

For me, adding this to the POM in build / plugins was the crucial step:

<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>

Upvotes: 0

abominable-dr-phibes
abominable-dr-phibes

Reputation: 21

In my case, I noticed that the deploy process was hanging when the system was downloading a small pre-existing file from the remote repository, and appeared to have an incorrect byte count (e.g. reported having downloaded "1009/1008 bytes"). This appears to happen occasionally when people deploy from different OS environments. My doubtless less-than-optimal way of resolving this problem was to log in to the remote repository and delete the offending file; this appeared to resolve the problem when I next tried to deploy the same project.

Upvotes: 0

Dave DeCaprio
Dave DeCaprio

Reputation: 2111

I had a similar problem, and the solution was to add "artifactory" to the server path. After tracing the actual HTTP traffic I could see that for the downloads the server was correctly redirectnng Maven from http://maven.myCompany.com/libs-release to http://maven.myCompany.com/artifactory/libs-release but for the upload this redirect wasn't working

So the answer for me was to change my pom to include correct path and avoid redirects:

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

Upvotes: 0

Bevor
Bevor

Reputation: 8605

I had a similar problem, exactly when executing release:perform. It got stuck while uploading. My solution was it to add a plugin, change some versions and one groupId in the build section from:

            <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>

to

            <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>

Upvotes: 0

Related Questions