1

写真を参照してください。「brandstore-repository.jar」という名前の 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
4

2 に答える 2

0

アーティファクトのダウンロードが遅いという同じ問題がありました。私はmaven-ant-tasks-2.1.3.jarを使用していました。あなたの「artifact:mvn」はmaven-ant-tasksにリンクされていると思います。探しているものではないかもしれませんが、artifact:mvn を exec に変更して問題を解決しました。

<exec executable="C:/apache-maven-3.0.3/bin/mvn.bat" dir="my-project">
     <arg value="clean" />
     <arg value="install" />
</exec>
于 2012-12-13T14:12:31.283 に答える