代码之家  ›  专栏  ›  技术社区  ›  harschware

从哈德逊那里得到所有的Maven作品

  •  1
  • harschware  · 技术社区  · 15 年前

    我有一个Maven项目,是一个儿童项目。它有许多兄弟项目,这个项目的任务是从兄弟中获取资源,并使用Antrun插件将它们打包到一个zip文件中。

    <project 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/maven-v4_0_0.xsd">
        <parent>
            <artifactId>SystemOfRegistries</artifactId>
            <groupId>someGroup</groupId>
            <version>0.0.1-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <groupId>someGroup</groupId>
        <artifactId>deploy-data</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>pom</packaging>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <configuration>
                                <tasks>
                                    <!--
                                        Place any Ant task here. You can add anything you can add
                                        between <target> and </target> in a build.xml.
                                    -->
                                    <zip destfile="${project.build.directory}/${build.finalName}.zip"
                                        whenempty="fail">
                                        <zipfileset dir="${project.parent.basedir}/build/AG" prefix="ag"/>
                                    </zip>
                                </tasks>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    

    这对建立拉链很有效。然而,问题是zip不是构建的工件。因此,哈德逊没有下载的链接。

    我想知道如何让哈德逊认识到这是马文的杰作,或者让马文认识到 伪影。(我曾经有包装元素丢失,然后我会得到一个不需要的罐子作为人工制品)。

    2 回复  |  直到 15 年前
        1
  •  1
  •   harschware    15 年前

    可以使用Builder Helper Maven插件

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <id>attach-artifacts</id>
                <phase>package</phase>
                <goals>
                    <goal>attach-artifact</goal>
                </goals>
                <configuration>
                    <artifacts>
                        <artifact>
                            <file>${project.build.directory}/${build.finalName}.zip</file>
                            <type>zip</type>
                        </artifact>
                    </artifacts>
                </configuration>
            </execution>
        </executions>
    </plugin>
    
        2
  •  1
  •   Ken Liu    15 年前

    构建助手Maven插件( attach-artifact goal )将告诉Maven一个特定的文件应该添加到Maven的项目工件列表中。在这种情况下,将包装设置为“pom”是正确的操作。

    请注意,如果您正在运行“安装”目标,那么您的zip文件也将被复制到本地Maven存储库中,但它将根据Maven约定进行重命名。只是需要注意的一点,如果您有依赖于这个工件的下游构建。