-
Notifications
You must be signed in to change notification settings - Fork 182
[MDEP-674] Add IDE build support #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c22e5a5
c34c3c7
2da2ab8
512800e
5c310ad
1b79277
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,21 @@ public abstract class AbstractDependencyMojo | |
@Component | ||
private ArchiverManager archiverManager; | ||
|
||
|
||
/** | ||
* For IDE build support | ||
*/ | ||
@Component | ||
private BuildContext buildContext; | ||
|
||
/** | ||
* Skip plugin execution during incremental builds (e.g. triggered from M2E). | ||
* | ||
* @since 3.3.1 | ||
slawekjaranowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
@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 @@ protected void copyFile( File artifact, File destFile ) | |
} | ||
|
||
FileUtils.copyFile( artifact, destFile ); | ||
buildContext.refresh( destFile ); | ||
} | ||
catch ( IOException e ) | ||
{ | ||
|
@@ -326,6 +343,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 +428,10 @@ public void setUseJvmChmod( boolean useJvmChmod ) | |
*/ | ||
public boolean isSkip() | ||
{ | ||
if ( skipDuringIncrementalBuild && buildContext.isIncremental() ) | ||
{ | ||
return true; | ||
} | ||
return skip; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specific only for Eclipse ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could be used by any IDE supporting incremental builds, but currently m2e is the only consumer, right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eclipse and its derivative, such as Java edition in VSCode. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there option to not store such specific IDE file here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fact is: There is no other metadata defined for any other IDE. Every IDE could reuse this metadata. We already have m2e metadata in other Maven plugins e.g. in https://github.com/apache/maven-resources-plugin/blob/master/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml or in https://github.com/apache/maven-enforcer/tree/master/maven-enforcer-plugin/src/main/resources/META-INF/m2e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which should have never been accepted.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Indeed that would be bad and was the reason why I/we the M2E team reached out to the Maven devs on their mailing list (the link @kwin posted above) to establish a unified API defined/maintained by Maven that all IDEs could use. Eventually this probably would have lead to a similar Maven-defined/maintained lifecycle-mapping metadata format (which actually also could be generated from annotations see e.g. eclipse-m2e/m2e-core#830). Anyway, as @mickaelistria said below we can maintain that metadata in a Eclipse M2E plug-in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A very very strange conclusion drawn from a ML thread having this post: https://lists.apache.org/thread/044tno4lvdjvm4yv7orsqpmn3x4175c4 (edit: typo) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right Guillaume Nodet was not averse to the suggestion, but from the other not so positive comments I had the impression that this was not the general conclusion. However, if that was a misinterpretation from my side and the suggestion will be considered in the future, I'm glad. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As there was no consensus to add m2e specific metadata I removed it now in c34c3c7. |
||
<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> | ||
kwin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</action> | ||
</pluginExecution> | ||
</pluginExecutions> | ||
</lifecycleMappingMetadata> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unmaintained dependency ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, it saw a new release at https://github.com/codehaus-plexus/plexus-build-api. The new GAV and packages are just not compatible with m2e yet (eclipse-m2e/m2e-core#944).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compare also with the discussion at https://lists.apache.org/thread/h2gy5l7j5bv7ycbpwdjby66v8gwhzck2.