Skip to content
Advertisement

Why during the install phase of maven cycle, package phase is called as well?

I have in my pom.xml a section

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <configuration>
      <pomFile>./lib/pom.xml</pomFile>
      <file>./lib/wls-maven-plugin.jar</file>
    </configuration>
    <executions>
       <execution> 
        <phase>install</phase>
            <goals>
              <goal>install-file</goal>
            </goals>
       </execution>
     </executions>

where i want to install the Weblogic plugin to my local repository. Note i indicated that i want this to be done in install phase. Then i want to use this plugin but in package and deploy phases. However when i try to run mvn install the package phase is invoked as well and i get error because my weblogic plugin is not installed yet. So why this is happening? I want my plugin to be installed first and then used. Sorry fo poor English.

Advertisement

Answer

The install goal tells Maven to install the artifact(s) produced by the project or module in question. Maven has to package them into a jar or other suitable artifacts in order to have anything to install.

You really shouldn’t be manually twiddling plugins like this. Instead, you should declare a proper Maven dependency on that Weblogic plugin, if it’s actually even necessary.

Advertisement