Reputation: 121
I have a maven project and I want to ask Eclipse to copy a dependency jar to WEB-INF/lib when I do right click -> Maven -> Update Project ...
By using the following plugin, I can copy the jar doing mvn validate. But what I want is executing this plugin when I do Maven -> Update Project ... with m2e
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.test.repo</groupId>
<artifactId>myDependencyJar</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/WebContent/WEB-INF/lib</outputDirectory>
</artifactItem>
</artifactItems>
<outputDirectory>${basedir}/WebContent/WEB-INF/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Upvotes: 1
Views: 345
Reputation: 11946
The Maven -> Update Project does not execute Maven at all. It just updates the Eclipse project with the data from the pom.xml file. So I would say it is not possible to execute a Maven plugin by that mean.
More on "Maven -> Update" here.
Upvotes: 1