见照片,我有一个名为“brandstore-repository.jar”的罐子
在我的localRepository中,我将其删除。
并且工件:mvn将其下载到私人服务器(10.8.12.100)
当我使用cmd时,使用“mvn install”命令,下载速度非常快!
但我在ant building.xml中使用“artifact:mvn”,感觉比较慢,需要等待大约10秒/每次下载!!
我在“$ {user.home} /。m2”中的setting.xml非常简单
<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>
在我的cmd命令行中,我使用“mvn clean install”代替
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>
非常快
我明白了,我只使用工件:依赖,也可以下载依赖jar,而且更快
<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>
结果:
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
答案 0 :(得分:1)
如果没有更多详细信息,例如settings.xml和确切的命令行,我只能猜测,但一个可能的原因是您在这些情况下使用不同的基础架构。
即,例如:
确保您始终使用相同的settings.xml
加上<mirrors>
,这样可以帮助您使传输路径保持一致。
答案 1 :(得分:0)
我有很慢的文件下载问题。我正在使用maven-ant-tasks-2.1.3.jar。我假设你的“artifact:mvn”与maven-ant-tasks相关联。也许这不是你想要的,但我通过改变工件解决了这个问题:mvn to exec:
<exec executable="C:/apache-maven-3.0.3/bin/mvn.bat" dir="my-project">
<arg value="clean" />
<arg value="install" />
</exec>