0

我正在尝试构建一个自解压 zip 文件并将其上传到我们的本地存储库,我的 pom.xml 中有以下代码片段

<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">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>com.myCompany.management</groupId>
    <artifactId>esm-parent-pom</artifactId>
    <version>SNAPSHOT</version>
</parent>
<groupId>com.myCompany.management.atg</groupId>
<artifactId>XYZ_ABC_SM</artifactId>
<version>SNAPSHOT</version>
<packaging>pom</packaging>
<name>${artifactId}</name>
<scm>
    <connection>scm:svn:http://scm.esm.myCompany.corp/svn/esm/trunk/build/smart-modules/XYZ_ABC_SM</connection>
    <url>http://scm.esm.myCompany.corp/viewer/browse/esm/esm/trunk/build/smart-modules/XYZ_ABC_SM</url>
</scm>
<url>${urlBase}/${artifactId}/${version}</url>
<distributionManagement>
    <site>
        <id>esm-site</id>
        <name>myCompany ESM Maven Site</name>
        <url>${siteDistributionBase}/${artifactId}/${version}</url>
    </site>
</distributionManagement>
<repositories>
    <repository>
        <id>esm-snapshot</id>
        <name>myCompany ESM Snapshots</name>
        <url>http://repo.esm.myCompany.corp/repo/esm-snapshot</url>
        <snapshots>
            <checksumPolicy>fail</checksumPolicy>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>


    <repository>
        <id>myCompany-main-release</id>
        <name>Factory Repository</name>
        <releases>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>http://repo.release.myCompany.corp/main/repo</url>
    </repository>


</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>esm-release</id>
        <name>ESM Release Repository</name>
        <releases>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>http://repo.esm.myCompany.corp/repo/esm</url>
    </pluginRepository>

    <pluginRepository>
        <id>myCompany-internal-release</id>
        <name>Factory Internal Repository</name>
        <releases>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>http://repo.release.myCompany.corp/internal/repo</url>
    </pluginRepository>
</pluginRepositories>

<build>
    <plugins>
        <!-- Step 1: download Schema Files. -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <!-- Gather Schema Files. -->
                            <artifactItem>
                                <groupId>com.myCompany.management</groupId>
                                <artifactId>management-oracle</artifactId>
                                <version>${project.version}</version>
                                <type>schema</type>
                                <outputDirectory>${project.build.directory}</outputDirectory>
                                <overWrite>true</overWrite>
                            </artifactItem>
                        </artifactItems>
                        <stripVersion>true</stripVersion>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- Step2: Convert into a Self Extracting Exe File -->
        <plugin>
            <groupId>com.myCompany.build</groupId>
            <artifactId>batch-plugin</artifactId>
            <version>1.1.2</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>executebatch</goal>
                    </goals>
                    <configuration>
                        <batchfilename>BuildLINUX64.bat</batchfilename>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- Step 4: Upload the newely build zip file out to our repository. -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <id>attach headers</id>
                    <phase>install</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>${project.build.directory}\XYZ_ABC_SM.exe</file>
                                <type>exe</type>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

Maven 仅在阶段处于包模式时将其上传到本地存储库,但是当我将其更改为安装时,它不会被上传。不应该是相反的吗?我正在使用mvn install运行 Maven。

4

0 回答 0