English 中文(简体)
Maven 组装插件在 Jenkins 中重新下载依赖性
原标题:Maven assembly plugin redownloading dependencies in jenkins

出于某种原因, Maven 每次我试图和Jenkins一起建造项目时, 似乎都在试图下载我的项目依赖关系。 有几个问题。 第一个问题是它根本不应该这样做, 另一个问题是它甚至没有试图从正确的回购中下载它们, 这意味着它必须等待它们每个人的暂停时间。

我可以自己运行 mvn 干净的软件包, 它在~ 4 秒内建造它, 因为所有依赖性都在我的当地. m2 repo。 Jenkins 是在本地安装的, 并且正在分享这个maven repo, 所以我不知道它为什么表现不同。 Jenkins 正在用 -B 和 -f 的旗帜发布maven 命令, 并且正在使用安装而不是软件包, 但即使我自己这样做, 它也会在几秒钟内完成, 而 Jenkins 需要大约8 分钟的时间, 因为它需要等待所有的时间。

我标记了Slick2d和lwjgl图书馆, 因为我觉得这和它们有关, 因为它们不是在公共的maven repo里,

唯一不同的是Jenkins花八分钟的时间超时, 而我自己却在几秒内完成。

另外,当我试图弄明白 最初,当我想手工做的时候,它也会发生。它停止这样做,因为我添加了马文原住民仓库, 但我不知道为什么詹金斯仍然在花时间, 因为他们分享相同的当地回购,

更新:在试图弄清楚究竟发生了什么之后, 我似乎缩小了范围, 将其与马文组装插件有关, 因为如果我把那个部分从我的口袋里拿出来, 效果会很好。

以下是我Pom档案的相关片段:

<repositories>
    <repository>
        <id>slick</id>
        <name>slick</name>
        <url>http://slick.cokeandcode.com/mavenrepo</url>
    </repository>
    <repository>
        <id>mavenNatives</id>
        <name>Maven Natives Repository</name>
        <url>http://mavennatives.googlecode.com/svn/repo</url>
    </repository>
    <repository>
        <id>nolat.org</id>
        <name>Nolat</name>
        <url>https://raw.github.com/Talon876/repo/master/releases</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>org.nolat</groupId>
        <artifactId>toolkit</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.lwjgl.lwjgl</groupId>
        <artifactId>lwjgl</artifactId>
        <version>2.8.3</version>
    </dependency>
    <dependency>
        <groupId>slick</groupId>
        <artifactId>slick</artifactId>
        <version>274</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        [...]
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>jar-with-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>${main}</mainClass>
                                <addClasspath>true</addClasspath>
                            </manifest>
                        </archive>
                        <appendAssemblyId>false</appendAssemblyId>
                    </configuration>
                </execution>
                <execution>
                    <id>dist</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptors>
                            <descriptor>src/META-INF/dist.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
 </build>

以下是Jenkins控制台的相关片段(每条下载线在放弃和继续之前坐了一段时间):

[JENKINS] Recording test results
mojoStarted org.apache.maven.plugins:maven-jar-plugin:2.3.2(default-jar)
[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ Falldown ---
mojoSucceeded org.apache.maven.plugins:maven-jar-plugin:2.3.2(default-jar)
mojoStarted org.apache.maven.plugins:maven-assembly-plugin:2.3(jar-with-dependencies)
[INFO] 
[INFO] --- maven-assembly-plugin:2.3:single (jar-with-dependencies) @ Falldown ---
Downloading: http://slick.cokeandcode.com/mavenrepo/phys2d/phys2d/060408/phys2d-    060408.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/phys2d/phys2d/060408/phys2d-060408.pom
Downloading:     https://raw.github.com/Talon876/repo/master/releases/phys2d/phys2d/060408/phys2d-060408.pom
Downloading: http://repo.maven.apache.org/maven2/phys2d/phys2d/060408/phys2d-060408.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/org/lwjgl/lwjgl/2.1.0/lwjgl-2.1.0.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/org/lwjgl/lwjgl/2.1.0/lwjgl-  2.1.0.pom
Downloading:    https://raw.github.com/Talon876/repo/master/releases/org/lwjgl/lwjgl/2.1.0/lwjgl-2.1.0.pom
Downloading: http://repo.maven.apache.org/maven2/org/lwjgl/lwjgl/2.1.0/lwjgl-2.1.0.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/org/lwjgl/lwjgl-jinput/2.1.0/lwjgl-jinput-2.1.0.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/org/lwjgl/lwjgl-   jinput/2.1.0/lwjgl-jinput-2.1.0.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/org/lwjgl/lwjgl- jinput/2.1.0/lwjgl-jinput-2.1.0.pom
Downloading: http://repo.maven.apache.org/maven2/org/lwjgl/lwjgl-jinput/2.1.0/lwjgl-jinput-2.1.0.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/org/lwjgl/lwjgl-native/2.1.0/lwjgl-native-2.1.0.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/org/lwjgl/lwjgl-native/2.1.0/lwjgl-native-2.1.0.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/org/lwjgl/lwjgl-native/2.1.0/lwjgl-native-2.1.0.pom
Downloading: http://repo.maven.apache.org/maven2/org/lwjgl/lwjgl-native/2.1.0/lwjgl-native-2.1.0.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/javax/jnlp/jnlp/1.2/jnlp-1.2.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/javax/jnlp/jnlp/1.2/jnlp-1.2.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/javax/jnlp/jnlp/1.2/jnlp-1.2.pom
Downloading: http://repo.maven.apache.org/maven2/javax/jnlp/jnlp/1.2/jnlp-1.2.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/ibxm/ibxm/unknown/ibxm-unknown.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/ibxm/ibxm/unknown/ibxm-unknown.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/ibxm/ibxm/unknown/ibxm-unknown.pom
Downloading: http://repo.maven.apache.org/maven2/ibxm/ibxm/unknown/ibxm-unknown.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/jcraft/jogg/0.0.7/jogg-0.0.7.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/jcraft/jogg/0.0.7/jogg-0.0.7.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/jcraft/jogg/0.0.7/jogg-0.0.7.pom
Downloading: http://repo.maven.apache.org/maven2/jcraft/jogg/0.0.7/jogg-0.0.7.pom
Downloading: http://slick.cokeandcode.com/mavenrepo/jcraft/jorbis/0.0.15/jorbis-0.0.15.pom
Downloading: http://mavennatives.googlecode.com/svn/repo/jcraft/jorbis/0.0.15/jorbis-0.0.15.pom
Downloading: https://raw.github.com/Talon876/repo/master/releases/jcraft/jorbis/0.0.15/jorbis-0.0.15.pom
Downloading: http://repo.maven.apache.org/maven2/jcraft/jorbis/0.0.15/jorbis-0.0.15.pom
[WARNING] Artifact: org.nolat:Falldown:jar:1.0-SNAPSHOT references the same file as the assembly destination file. Moving it to a temporary location for inclusion.
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
...and so on
问题回答

获得稳定的马文建筑的第一步是使用马文仓库管理器,例如