使用jenkins作业将zip文件上载到nexus

时间:2015-05-05 11:03:09

标签: maven jenkins zip nexus

我有一个使用maven antrun插件生成zip文件的项目。我想使用我的jenkins工作将此zip文件上传到我的nexus repo。

我的pom.xml的构建部分如下

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>${maven-antrun-plugin.version}</version>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <mkdir dir="${targetFolder}\conf"/>
                            <copy todir="${targetFolder}\conf">
                                <fileset dir="${configurationSource}"/>
                            </copy>
                            <copy file="${basedir}\worker.sh" todir="${targetFolder}"></copy>

                            <zip destfile="${project.build.directory}\${workerDeploy}.zip"
                                 basedir="${project.build.directory}"
                                 excludes="classes/** surefire/** antrun/** maven-archiver/** *.zip"/>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${maven-jar-plugin.version}</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.hp.wpp.worker.Application</mainClass>
                        <classpathPrefix>dependency/</classpathPrefix>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <manifestEntries>
                        <Class-Path>conf/</Class-Path>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

我怎样才能做到这一点?

0 个答案:

没有答案