Maven deploy hangs while downloading maven_metadata.xml if it exists already

Viewed 6605

I have configured my project to be deployed to my own repository. When I run mvn deploy it looks like it's working but hangs at the stage for downloading the maven_metadata.xml file to after it's uploaded the jars.

INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ myproject ---
Uploading: scp://myrepodomain/.../myproject-0.06-2.jar
Uploaded: scp://myrepodomain/.../myproject-0.06-2.jar (39013 KB at 6234.1 KB/sec)
Uploading: scp://myrepodomain/.../myproject-0.06-2.pom
Uploaded: scp://myrepodomain/.../myproject-0.06-2.pom (8 KB at 21.6 KB/sec)
Downloading: scp://myrepodomain/.../maven-metadata.xml 
320/319 B
.....here is where it just hangs forever

If I delete the maven-metadata.xml file on the server, it works fine and just uploads a freshly generated one.

I should also mention that I am just using a simple HTTP server with SCP, I find the larger artifact systems to be way overkill for what I am doing. I can't figure out how to even debug this. Any suggestions would be appreciated.

4 Answers

I had a problem like this. When I tried wget these ...maven_metadata.xml URLs I received a 404 response.

My solution was to shorten the timeout for these servers (from 2 minutes default to 2 seconds).

First you have to find the ID of the repository for this URL. That is if you are stuck on downloading from artifactoryonline.org, search for this repository in your POMs:

$ find . -name 'pom*.xml' | xargs grep factoryonline

Go to the found POM and fetch the repository ID. Then edit your ~/.m2/settings.xml to something like this:

<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">
    <servers>
            <server>
                    <id>Metamarkets-repository</id>
                    <configuration>
                            <httpConfiguration>
                                    <all>
                                            <connectionTimeout>2000</connectionTimeout>
                                            <readTimeout>2000</readTimeout>
                                    </all>
                            </httpConfiguration>
                    </configuration>
            </server>
    </servers>
</settings>

This will make the downloading give up after 2 seconds and let the build continue (assuming the maven_metadata.xml will be downloaded from somewhere else).

Related