-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Use BuildContext to notify about newly generated files/folders
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <a href="mailto:[email protected]">Brian Fox</a> | ||
|
@@ -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; | ||
|
||
/** | ||
* <p> | ||
* 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; | ||
} | ||
|
||
|