看照片,我有一个名为“brandstore-repository.jar”的罐子
在我的 localRepository 中,我将其删除。
并且 artifact: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>
非常快
我明白了,我只使用 artifact:dependencies ,也可以下载依赖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