maven-deploy-plugin 没有执行它的执行

maven-deploy-plugin not executing its execution

我需要从我的项目本身部署自定义 jar 我用默认执行覆盖了 maven-deploy-plugin 两个以上的执行。下面是我的 pom.xml 以及我用于部署的 distributionManagement 和 maven-deploy-plugin。

<groupId>mycompany</groupId>
<artifactId>myproject</artifactId>
<packaging>jar</packaging>

<distributionManagement>
    <repository>
        <id>temp</id>
        <name>Release Repository</name>
        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
    </repository>
</distributionManagement>

<dependencies>
    <dependency>
        some dependency
    </dependency>

    <dependency>
        some dependency
    </dependency>

    <dependency>
        some dependency
    </dependency>
</dependencies>
<build>
    <plugins>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <executions>
                <execution>
                    <id>default-deploy</id>
                    <phase>none</phase>
                </execution>

                <execution>
                    <id>myjar-one</id>
                    <phase>deploy</phase>
                    <configuration>
                        <repositoryId>temp</repositoryId>
                        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                        <packaging>jar</packaging>
                        <artifactId>myjar-one</artifactId>
                        <groupId>${project.groupId}</groupId>
                        <version>${project.version}</version>
                        <sources>${project.build.directory}/build/lib/myjar-one.jar</sources>
                    </configuration>
                </execution>


                <execution>
                    <id>myjar-two</id>
                    <phase>deploy</phase>
                    <configuration>
                        <repositoryId>temp</repositoryId>
                        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                        <packaging>jar</packaging>
                        <artifactId>myjar-two</artifactId>
                        <groupId>${project.groupId}</groupId>
                        <version>${project.version}</version>
                        <sources>${project.build.directory}/build/lib/myjar-two.jar</sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>


</build>

伙计们,我解决了这个问题,我需要解决以下问题。

  1. 需要添加目标。
  2. 需要使用文件标签而不是源标签。 所以最终的 maven-deploy-plugin 看起来像。

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
            <execution>
                <id>default-deploy</id>
                <phase>none</phase>
            </execution>
    
            <execution>
                <id>myjar-one</id>
                <phase>deploy</phase>
                <goals>
                    <goal>deploy-file</goal>
                </goals>
                <configuration>
                    <repositoryId>temp</repositoryId>
                    <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                    <packaging>jar</packaging>
                    <artifactId>myjar-one</artifactId>
                    <groupId>${project.groupId}</groupId>
                    <version>${project.version}</version>
                    <file>${project.build.directory}/build/lib/myjar-one.jar</file>
                </configuration>
            </execution>
    
    
            <execution>
                <id>myjar-two</id>
                <phase>deploy</phase>
                <goals>
                    <goal>deploy-file</goal>
                </goals>
                <configuration>
                    <repositoryId>temp</repositoryId>
                    <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                    <packaging>jar</packaging>
                    <artifactId>myjar-two</artifactId>
                    <groupId>${project.groupId}</groupId>
                    <version>${project.version}</version>
                    <file>${project.build.directory}/build/lib/myjar-two.jar</file>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    解决此问题后,我的两个自定义 jar 都部署在我的 maven 存储库中。感谢帮助