如何跳过 maven 默认部署,而是在 pom 中使用部署插件



我在我的pom中添加了部署插件,它可以使用自定义名称app-service-0.1-SNAPSHOT-standalone.jar部署文件。

      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8.2</version>
        <executions>
          <execution>
            <id>deploy-file</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy-file</goal>
            </goals>
            <configuration>
              <repositoryId>app-snapshots</repositoryId>
              <file>targetapp-service-0.1-SNAPSHOT.jar</file>
              <url>https://artifactory.intranet.app.com/artifactory/mvn-snapshot-local</url>
              <groupId>com.app.test</groupId>
              <artifactId>app-service</artifactId>
              <version>0.1-SNAPSHOT</version>
              <files>targetapp-service.jar</files>
              <classifiers>int</classifiers>
              <types>jar</types>
            </configuration>
          </execution>
        </executions>
      </plugin>
但是,由于默认部署

仍会启动,因此该文件也以默认名称部署,app-service-0.1-SNAPSHOT.jar .有没有办法抑制默认部署?

将执行 ID 从 deploy-file 更改为 default-deploy 。这将覆盖 Maven 的默认执行以执行您想要的操作。请参阅 Maven 文档和此相关答案。

只需在插件级别下添加<configuration><skip>true</skip></configuration>即可。

最新更新