diff --git a/pom.xml b/pom.xml index b3de43a3a..fb2755898 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,15 @@ under the License. ${resolverVersion} provided + + + org.sonatype.plexus + plexus-build-api + 0.0.7 + compile + + + org.eclipse.aether aether-connector-basic @@ -265,8 +274,6 @@ under the License. ${resolverVersion} test - - junit junit diff --git a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java index 16756cb23..5294bef87 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java @@ -46,6 +46,7 @@ import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.ReflectionUtils; import org.codehaus.plexus.util.StringUtils; +import org.sonatype.plexus.build.incremental.BuildContext; /** * @author Brian Fox @@ -59,6 +60,22 @@ public abstract class AbstractDependencyMojo @Component private ArchiverManager archiverManager; + + /** + * For IDE build support + */ + @Component + private BuildContext buildContext; + + /** + * Skip plugin execution only during incremental builds (e.g. triggered from M2E). + * + * @since 3.4.0 + * @see #skip + */ + @Parameter( defaultValue = "false" ) + private boolean skipDuringIncrementalBuild; + /** *

* will use the jvm chmod, this is available for user and all level group level will be ignored @@ -189,6 +206,7 @@ protected void copyFile( File artifact, File destFile ) } FileUtils.copyFile( artifact, destFile ); + buildContext.refresh( destFile ); } catch ( IOException e ) { @@ -326,6 +344,7 @@ protected void unpack( Artifact artifact, String type, File location, String inc { throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location, e ); } + buildContext.refresh( location ); } private void silenceUnarchiver( UnArchiver unArchiver ) @@ -410,6 +429,10 @@ public void setUseJvmChmod( boolean useJvmChmod ) */ public boolean isSkip() { + if ( skipDuringIncrementalBuild && buildContext.isIncremental() ) + { + return true; + } return skip; }