如何跳过Maven默认部署而不是在pom中使用deploy插件?

时间:2019-07-10 13:56:42

标签: maven maven-deploy-plugin

我在pom中添加了deploy插件,它可以部署具有自定义名称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>target\app-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>target\app-service.jar</files>
              <classifiers>int</classifiers>
              <types>jar</types>
            </configuration>
          </execution>
        </executions>
      </plugin>

但是,由于仍将启动默认部署,因此文件也将以默认名称app-service-0.1-SNAPSHOT.jar进行部署。有没有办法抑制默认部署?

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

将执行ID从deploy-file更改为default-deploy。这将覆盖Maven的默认执行以执行所需的操作。请参见Maven docsthis related answer