Nexus Issue while trying to Upload Snapshots into Nexus Snapshot repository - maven

I am getting the following error in Nexus Snapshot repository while trying to upload snapshots.
Downloading: http://maven.teamccp.com/content/repositories/snaphot/apps/home/home-parent/2.1-SNAPSHOT/maven-metadata.xml
Uploading: http://maven.teamccp.com/content/repositories/snaphot/apps/home/home-parent/2.1-SNAPSHOT/home-parent-2.1-20141113.150651-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Home Parent ............................... FAILURE [ 0.742 s]
[INFO] Home Commons .............................. SKIPPED
[INFO] Home app .................................. SKIPPED
[INFO] Distribution ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.860 s
[INFO] Finished at: 2014-11-13T10:06:51-05:00
[INFO] Final Memory: 4M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project home-parent: Failed to deploy artifacts: Could not find artifact apps.home:home-parent:pom:2.1-20141113.150651-1 in snapshot (http://maven.teamccp.com/content/repositories
I am able to successfuly upload releases. Plz help. Thanks in advance.

The nexus manager has default snapshot repository, which is where your organization will publish internal snapshots. Your deploy cannot find distributionManagement of snapshotRepository, so the error will occur like your question. Therefore, you should set snapshotRepository for deploy your snapshot artifacts. The example is shown below.
pom.xml
<distributionManagement>
<repository>
<id>releases</id>
<url>http://your-hostname:port/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://your-hostname:port/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
settings.xml
<server>
<id>releases</id>
<username>your-server-username</username>
<password>your-server-password</password>
</server>
<server>
<id>snapshots</id>
<username>your-server-username</username>
<password>your-server-password</password>
</server>

Each Uploading: line should be followed by a corresponding Uploaded: line, and since that's missing, my guess is that your upload failed for some reason. I'd check your Nexus logs to see if there's any indication.
I experienced the same problem when my remote repository was out of space (which I found by logging onto the server); I didn't see anything in the Artifactory log.

Related

Push docker image to Nexus

Hello I have Jenkins and Nexus on the same server. When Jenkins build project correctly, i want push image to Nexus 3, but every time i have the same problem (log below).
Configuration:
pom.xml
<nexus.url>http://adress/#browse/browse/components:docker-image</nexus.url>
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<url>${nexus.url}</url>
</snapshotRepository>
</distributionManagement>
...
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.4</version>
<extensions>true</extensions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>${nexus.url}</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
And i have file settings.xml:
<servers>
<server>
<id>nexus</id>
<username>login</username>
<password>password</password>
</server>
</servers>
Then i try "mvn clean deploy" and result is:
[INFO] Deploying remotely...
[INFO] Bulk deploying locally gathered artifacts from directory:
[INFO] * Bulk deploying locally gathered snapshot artifacts to URL http://adress/repository/image-docker/
Downloading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/maven-metadata.xml
Uploading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar
Uploading: http://adress/repository/image-docker/someProject//0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:58 min
[INFO] Finished at: 2016-12-13T10:30:35+01:00
[INFO] Final Memory: 75M/748M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.4:deploy (injected-nexus-deploy) on project someProject:
Failed to deploy artifacts: Could not transfer artifact someProject:jar:0.1-20161213.093022-1 from/to nexus (http://adress/repository/image-docker/):
Failed to transfer file: http://adress/repository/image-docker/someProject/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar.
Return code is: 502, ReasonPhrase: Bad Gateway. -> [Help 1]
Every time is the same problem with 502 - Bad Gateway.
Do you have some proposal?
Unfortunately this will not work for a few reasons.
The URL you are using as a Nexus url is wrong, that URL is the browser URL. You need to use something more akin to https://nexusurl:portofdockerhostedrepo/repository/nameofdockerhostedrepo. You can get more information on setting up and pushing Docker images here: https://books.sonatype.com/nexus-book/reference3/docker.html#docker-push
Unless I'm completely wrong, mvn deploy is primarily for deploying maven artifacts into Maven repositories. I don't think this will work if you are attempting to deploy a Docker image. You might take a look at using something like this: https://github.com/spotify/docker-maven-plugin
Hope this helps.

mvn deploy snapshot to nexus oss failed with return code 500 internal error

I use maven to deploy artifact to sonatype nexus,I can perform release action normally,but deploy snapshots failed.
sonatype nexus 2.7.0.5
Java 1.7
maven 3.0.5
mvn release:prepare;mvn release:perform; successful without any error
mvn deploy failed with return code 500
[INFO] maven-jar-plugin:2.4:jar (default-jar) # licm
[INFO] Building jar: /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar
[INFO]
[INFO] maven-install-plugin:2.3.1:install (default-install) # licm
[INFO] Installing /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.jar
[INFO] Installing /foo/licm/trunk/pom.xml to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) # licm ---
Downloading: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml
from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file:
http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/
maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.824s
[INFO] Finished at: Fri Dec 20 01:20:33 CST 2013
[INFO] Final Memory: 8M/20M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project licm: Failed to retrieve remote metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error. -> [Help 1]"
This is my first time to deploy snapshots to remote repository,so there have nothing in snapshot repository on nexus server
settings.xml
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>Releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>Nexus</id>
<name>Nexus Public Mirror</name>
<url>http://xxx.xxx.com:8080/nexus/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
pom.xml
<distributionManagement>
<repository>
<id>Releases</id>
<name>xxx Releases Repositories</name>
<url>http://xxx.xxx.com:8080/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>xxx Snapshots Repositories</name>
<url>http://xxx.xxx.com:8080/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
I've encountered the same return code (500) and reason (Internal server error), and finnaly found that the nexus server disk space is full. :) Checking the nexus log in the server could find this clue.
Answer myself.
When the nexus server can't find the maven-metadata.xml,it will cause tomcat throw an exception,this is the problem
I change the Tomcat version from 6.x to 7.0.x,everything is ok
Nexus requires a Servlet 3.0 compliant container. It comes bundled with a Servlet 3.0 compliant Jetty 8. If you deploy it on another container you have to make sure it is compliant. Couldn't find this in the documtation but from own experience it seems to be the case.
When you
HTTP GET
http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
in a browser you should be able to see the stacktrace, which contains
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()
This is only available in Servlet 3.0 containers.
This was the error reported as similar in my case:
Failed to transfer file:
http://192.168.0.2:8080/repository/maven-snapshots/org/xxxx/xxx-yyy/1.0-SNAPSHOT/maven-metadata.xml.
Return code is: 500 , ReasonPhrase:Server Error.
In my case after doing the http file verification suggested by #hansi, the server response was javax.servlet.ServletException: java.lang.NumberFormatException: null.
After doing some review about what causes this, I found that is is because a problem with the artifact creation timestamp. In my case the maven-metadata.xml was corrupted and it was caused by a reboot in the server that adjusted the time automatically after the daylight saving time was in efect. I got a clue about it in this post https://issues.sonatype.org/browse/NEXUS-12496
What worked in my case was to delete the maven-metadata.xml in all the artifact references. After that the error was corrected.
In here we get failure.
Downloading: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
then we cant get that release snapshot so we do manually in pom.xml file
updated to related dependency details then it will work.

How do I configure my maven settings.xml in order to use the minify-maven-plugin?

I have a project where the pom.xml makes use of the minify-maven-plugin. I couldn't find any documentation on how to configure the pluginRepository entry in my $M2_HOME/conf/settings.xml, so I took a wild guess and added this entry:
<pluginRepository>
<id>minify-maven-plugin-repo</id>
<name>minify-maven-plugin repository</name>
<url>https://github.com/samaxes/minify-maven-plugin</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
But when I run mvn minify:minify from my project directory I get:
C:\Users\J1NDH02\work\webui-war>mvn minify:minify
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'minify'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.apache.maven.plugins: checking for updates from minify-maven-plugin-r
epo
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from minify-maven-plugin-repo
[INFO] artifact org.apache.maven.plugins:maven-minify-plugin: checking for updat
es from central
[INFO] artifact org.apache.maven.plugins:maven-minify-plugin: checking for updat
es from minify-maven-plugin-repo
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-minify-plugin' does not exist
or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Aug 14 15:23:04 CDT 2013
[INFO] Final Memory: 36M/308M
[INFO] ------------------------------------------------------------------------
Running `mvn -X minify:minify' generates this error message:
[INFO] Searching repository for plugin with prefix: 'minify'.
[DEBUG] Loading plugin prefixes from group: org.apache.maven.plugins
[DEBUG] Loading plugin prefixes from group: org.codehaus.mojo
[DEBUG] maven-minify-plugin: using locally installed snapshot
[DEBUG] Artifact not found - using stub model: Unable to determine the latest version
org.apache.maven.plugins:maven-minify-plugin:pom:LATEST
[DEBUG] Using defaults for missing POM org.apache.maven.plugins:maven-minify-plugin:pom:LATEST
[DEBUG] maven-minify-plugin: using locally installed snapshot
[DEBUG] Artifact not found - using stub model: Unable to determine the release version
org.apache.maven.plugins:maven-minify-plugin:pom:RELEASE
[DEBUG] Using defaults for missing POM org.apache.maven.plugins:maven-minify-plugin:pom:RELEASE
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-minify-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-minify-plugin' does not exist or no valid version could be found
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
What am I getting wrong?
I'm using Maven 2.2. I added the egit plugin in case I needed it, since the minify-maven-plugin is on github.
Upto my understanding you have to only change the pom file to include this plugin under build.
The same plugin is available in Maven central repo here.
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>default-minify</id>
<phase>process-resources</phase>
<configuration></configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
Note : I have used the version 1.7 here , you can change as per your jdk version

Unable to build sonar project. Error: Cannot find parent: org.codehaus.sonar:sonar

Trying to build our java app using sonar for analysis. We are behind a firewall so no access to maven repo1. We do have a internal corp Artifactory for third party artifacts and a project Artifactory for our local stuff. I am the SCM guy in charge of our build server, not a developer. That said the application with junit tests builds fine. We have two goals clean install. The sonar server is 3.5.1 and the port set to 8080 instead of 9000 This is in our pom.
<profile>
<id>sonarJsEnabled</id>
<properties>
<srcDir>src/main/static</srcDir>
<sonar.exclusions>libs/**/*,DSTCore/**/*,test/**/*</sonar.exclusions>
<maven.test.skip>true</maven.test.skip>
<sonar.language>js</sonar.language>
<sonar.branch>js</sonar.branch>
</properties>
</profile>
<profile>
<id>sonarHtmlEnabled</id>
<properties>
<srcDir>src/main/static</srcDir>
<sonar.language>web</sonar.language>
<sonar.branch>web</sonar.branch>
<sonar.web.fileExtensions>html,xhtml,jspf,jsp</sonar.web.fileExtensions>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- SERVER ON A REMOTE HOST -->
<sonar.host.url>http://10.226.xx.xx:8080</sonar.host.url>
</properties>
</profile>
and this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>1.0-beta-2</version>
</plugin>
We add sonar:sonar When we build manually or with Bamboo we get this output.
C:\sonartest>mvn sonar:sonar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] org.apache.maven.plugins: checking for updates from EnterpriseArchitectureRepo
[INFO] org.codehaus.mojo: checking for updates from EnterpriseArchitectureRepo
[INFO] artifact org.codehaus.mojo:sonar-maven-plugin: checking for updates from EnterpriseArchitectureRepo
[INFO] Ignoring available plugin update: 2.0 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 2.0-beta-2 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 2.0-beta-1 as it requires Maven version 3.0
[INFO] ------------------------------------------------------------------------
[INFO] Building fundTrader
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://10.226.xx.xx:8080
[INFO] Sonar version: 3.5.1
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:3.5.1:sonar
Downloading: http://repository.corp.net:8080/artifactory/libs-release/org/codehaus/sonar/sonar/3.5.1/sonar-3.5.1.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar:pom:3.5.1' in repository EnterpriseArchitectureRepo (http://repository.corp.net:8080/artifactory/libs-release)
...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin 'org.codehaus.sonar:sonar-maven-plugin': Cannot find parent: org.codehaus.sonar:sonar for project: null:sonar-maven-plugin:maven-plugin:null for project null:sonar-maven-plugin:maven-plugin:null
Unable to download the artifact from any repository
Any help would be greatly apreciated.
I looks like the sonar-3.5.1.pom is not found. Consider adding Bintray's jcenter remote repository to your Artifactory (it has much more artifacts than Maven Center).
The simplest way to do it is to import the jcenter configuration from an Artifactory instance at repo.jfrog.org.
Just click on the Import -> Load and select jcenter from the list of loaded repository configurations.

Why ant use maven-ant-tasks,artifact:mvn download dependency jar so slowly

See photo, I have a jar named "brandstore-repository.jar"
In my localRepository,I delete it.
And artifact:mvn will downloading it in the private server (10.8.12.100)
When i use cmd,use "mvn install" command , downloading it very fast!
But i use "artifact:mvn" in ant building.xml,I feel relatively slow,need to wait for about 10+ seconds/every download!!
My setting.xml which in "${user.home}/.m2", is so easy
<settings 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/settings-1.0.0.xsd">
<localRepository>D:\FeiLong Soft\Essential\Development\repository</localRepository>
<profiles>
<profile>
<id>profile-baozun</id>
<repositories>
<repository>
<id>public</id>
<url>http://10.8.12.100/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>profile-baozun</activeProfile>
</activeProfiles>
</settings>
In my cmd commandline, I use "mvn clean install" instead
E:\Workspaces\baozun\converseplatform\converse-repo>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building converse-repo
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory E:\Workspaces\baozun\converseplatform\converse-repo\target
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
Downloading: http://10.8.12.100/nexus/content/groups/public/com/jumbo/brandstore/brandstore-repository/4.0.0/brandstore-repository-4.0.0.pom
1K downloaded (brandstore-repository-4.0.0.pom)
Downloading: http://10.8.12.100/nexus/content/groups/public/com/jumbo/brandstore/brandstore/4.0.0/brandstore-4.0.0.pom
17K downloaded (brandstore-4.0.0.pom)
Downloading: http://10.8.12.100/nexus/content/groups/public/com/jumbo/brandstore/brandstore-repository/4.0.0/brandstore-repository-4.0.0.jar
913K downloaded (brandstore-repository-4.0.0.jar)
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 87 source files to E:\Workspaces\baozun\converseplatform\converse-repo\target\classes
[INFO] [native2ascii:native2ascii {execution: native2ascii}]
[INFO] Includes: [**/*.properties]
[INFO] Excludes: []
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 20 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 12 source files to E:\Workspaces\baozun\converseplatform\converse-repo\target\test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: E:\Workspaces\baozun\converseplatform\converse-repo\target\converse-repo-4.0.0.jar
[INFO] [install:install {execution: default-install}]
[INFO] Installing E:\Workspaces\baozun\converseplatform\converse-repo\target\converse-repo-4.0.0.jar to D:\FeiLong Soft\Essential\Development\repository\com\jum
bo\converse\converse-repo\4.0.0\converse-repo-4.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Nov 28 11:03:17 CST 2012
[INFO] Final Memory: 39M/94M
[INFO] ------------------------------------------------------------------------
E:\Workspaces\baozun\converseplatform\converse-repo>
very fast
I see, I only use artifact:dependencies ,also can downloading dependency jar,and faster
<target name="maven-test">
<artifact:pom id="feilongMaven" file="pom.xml" />
<artifact:dependencies filesetId="feilong.maven.dependencies.fileset" pathid="feilong.maven.dependencies.runtime" useScope="runtime">
<pom refid="feilongMaven" />
</artifact:dependencies>
</target>
result:
maven-test:
[artifact:dependencies] Downloading: com/jumbo/brandstore/brandstore-repository/4.0.0/brandstore-repository-4.0.0.pom from repository public at http://10.8.12.100/nexus/content/groups/public
[artifact:dependencies] Transferring 2K from public
[artifact:dependencies] Downloading: com/jumbo/brandstore/brandstore/4.0.0/brandstore-4.0.0.pom from repository public at http://10.8.12.100/nexus/content/groups/public
[artifact:dependencies] Transferring 18K from public
[artifact:dependencies] Downloading: com/jumbo/brandstore/brandstore-repository/4.0.0/brandstore-repository-4.0.0.jar from repository public at http://10.8.12.100/nexus/content/groups/public
[artifact:dependencies] Transferring 914K from public
BUILD SUCCESSFUL
Total time: 1 second
Without more details, like your settings.xml and exact commandlines, I can only guess, but one possible reason is that you use different infrastructure in these cases.
That is, for instance:
when invoking Maven, your company proxy (nexus or whatever) is used
when invoking Ant, some other proxy (or none) is used, resulting in slower transfer
Make sure you always use the same settings.xml plus that you have <mirrors> in it, and that should help you make your transfer paths consistent.
I had the same problem with slow download of artifacts. I was using maven-ant-tasks-2.1.3.jar. I assume your "artifact:mvn" is linked with maven-ant-tasks. Maybe it is not what you're looking for, but I resolved the issue by changing artifact:mvn to exec:
<exec executable="C:/apache-maven-3.0.3/bin/mvn.bat" dir="my-project">
<arg value="clean" />
<arg value="install" />
</exec>

Resources