How to override maven-install-plugin default behavior?

I need a custom artifact setting and cannot figure out how to override the default value (due to the maven default life cycle). So my question is:

How to configure maven install plugin in my pom.xml so that it does not perform the default installation and only fulfill my custom installation file goals?

I tried without id and default-install and this did not help.

Update: From the provided answer - this does not work for me (I see two installation attempts in the log).

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-install-plugin</artifactId>
      <executions>
        <execution>
          <id>default-install</id>
          <phase>none</phase>
        </execution>
      </executions>
    </plugin>
  </plugins>
</pluginManagement>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
      <execution>
        <id>install-jar-lib</id>
        <goals>
          <goal>install-file</goal>
        </goals>
        <phase>install</phase>
        <configuration>
          <file>${project.build.directory}/${project.build.finalName}.jar</file>
          <generatePom>false</generatePom>
          <pomFile>pom.xml</pomFile>
          <packaging>jar</packaging>
          <version>${unicorn.version}</version>
        </configuration>
      </execution>
    </executions>
  </plugin>
+3
source share
3 answers

, 2.4 .

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

( ant - ) ,

 <phase>install</phase>

,

 mvn install
+2

maven-install-plugin:

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.3.1</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </pluginManagement>
</build>

:

<build>
  <plugins>
    <plugin>
      <groupId>yourGroupId</groupId>
      <artifactId>yourArtifactId</artifactId>
      <executions>
        <execution>
          <id>custom-install</id>
          <phase>install</phase>
          <goals>
            <goal>yourGoal</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
+7

What is your goal? What did you put there?

0
source

All Articles