You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2022/10/28 11:25:38 UTC
[maven-dependency-plugin] branch feature/incremental-build-support updated (f64069b1 -> a8110029)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a change to branch feature/incremental-build-support
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
discard f64069b1 MDEP-674 Add m2e lifecycle metadata
new a8110029 MDEP-674 Add m2e lifecycle metadata
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (f64069b1)
\
N -- N -- N refs/heads/feature/incremental-build-support (a8110029)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/maven/plugins/dependency/AbstractDependencyMojo.java | 2 ++
1 file changed, 2 insertions(+)
[maven-dependency-plugin] 01/01: MDEP-674 Add m2e lifecycle metadata
Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/incremental-build-support
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit a8110029b46a88a2ad30fa475b7cf01b07608ef1
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Oct 28 13:24:58 2022 +0200
MDEP-674 Add m2e lifecycle metadata
Use BuildContext to notify about newly generated files/folders
---
pom.xml | 11 +++-
.../plugins/dependency/AbstractDependencyMojo.java | 22 +++++++
.../META-INF/m2e/lifecycle-mapping-metadata.xml | 68 ++++++++++++++++++++++
3 files changed, 99 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b3de43a3..39eab2b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -247,6 +247,15 @@ under the License.
<version>${resolverVersion}</version>
<scope>provided</scope>
</dependency>
+ <!-- incremental build support (http://www.eclipse.org/m2e/documentation/m2e-making-maven-plugins-compat.html) -->
+ <dependency>
+ <groupId>org.sonatype.plexus</groupId>
+ <artifactId>plexus-build-api</artifactId>
+ <version>0.0.7</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- test -->
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-basic</artifactId>
@@ -265,8 +274,6 @@ under the License.
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
-
- <!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
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 16756cb2..6466b010 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.components.io.fileselectors.IncludeExcludeFileSelecto
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:brianf@apache.org">Brian Fox</a>
@@ -59,6 +60,21 @@ public abstract class AbstractDependencyMojo
@Component
private ArchiverManager archiverManager;
+
+ /**
+ * For m2e incremental build support
+ */
+ @Component
+ private BuildContext buildContext;
+
+ /**
+ * Skip plugin execution during incremental builds (e.g. triggered from M2E).
+ *
+ * @since 3.3.1
+ */
+ @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 +205,7 @@ public abstract class AbstractDependencyMojo
}
FileUtils.copyFile( artifact, destFile );
+ buildContext.refresh( destFile );
}
catch ( IOException e )
{
@@ -326,6 +343,7 @@ public abstract class AbstractDependencyMojo
{
throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location, e );
}
+ buildContext.refresh( location );
}
private void silenceUnarchiver( UnArchiver unArchiver )
@@ -410,6 +428,10 @@ public abstract class AbstractDependencyMojo
*/
public boolean isSkip()
{
+ if ( skipDuringIncrementalBuild && buildContext.isIncremental() )
+ {
+ return true;
+ }
return skip;
}
diff --git a/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
new file mode 100644
index 00000000..39432065
--- /dev/null
+++ b/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
@@ -0,0 +1,68 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <goals>
+ <goal>copy</goal>
+ <goal>copy-dependencies</goal>
+ <goal>properties</goal>
+ <goal>unpack</goal>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>true</runOnIncremental>
+ <runOnConfiguration>false</runOnConfiguration>
+ </execute>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <goals>
+ <goal>analyze</goal>
+ <goal>analyze-dep-mgmt</goal>
+ <goal>analyze-only</goal>
+ <goal>analyze-report</goal>
+ <goal>analyze-duplicate</goal>
+ <goal>build-classpath</goal>
+ <goal>display-ancestors</goal>
+ <goal>get</goal>
+ <goal>go-offline</goal>
+ <goal>list</goal>
+ <goal>list-classes</goal>
+ <goal>list-repositories</goal>
+ <goal>purge-local-repository</goal>
+ <goal>resolve</goal>
+ <goal>resolve-plugins</goal>
+ <goal>sources</goal>
+ <goal>tree</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ <runOnConfiguration>false</runOnConfiguration>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+</lifecycleMappingMetadata>
\ No newline at end of file