Run Maven plugin before deploying to remote repo

In my maven project, I use the pgp plugin to sign my cans. I need to do this only when deploying to a remote repo, but not when installing to a local repo. So I tried to set the phase for deployment.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <id>sign-artifacts</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

With this configuration, maven is first deployed in a remote repo, and theh introduces my jars ...

I read that plugins are executed in the order in which they are defined in the POM file, so I tried to configure the deploy-plugin plugin after the plugin, but this had no effect

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <id>sign-artifacts</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
            <executions>
                <execution>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

How can I achieve that the plugin for the character is not executed during installation, but when deployed before loading artifacts? I am using maven3.

+2
2

maven-gpg-plugin , 1.1 2010 . , maven-deploy-plugin deploy maven-gpg-plugin verify, , . , , .

<plugin>
  <inherited>true</inherited>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>2.8.2</version>
  <configuration>
    <updateReleaseInfo>true</updateReleaseInfo>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>deploy</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-gpg-plugin</artifactId>
  <version>1.6</version>
  <executions>
    <execution>
      <id>sign-artifacts</id>
      <goals>
        <goal>sign</goal>
      </goals>
    </execution>
  </executions>
</plugin>
+1

, gpg-plugin verify.

, Maven ? , , , Maven 2.0.10 (, , ). , maven-deploy-plugin deploy, ,

0

Source: https://habr.com/ru/post/1612470/


All Articles