Skip to content

Commit ecfa1bc

Browse files
committed
Configure the script-maven-plugin for Eclipse
Third-party Maven plugins with goals bound to phases need to have those goals mapped to Eclipse's incremental and/or configuration build steps.
1 parent eabf999 commit ecfa1bc

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

pom.xml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,62 @@
221221
</plugins>
222222
</pluginManagement>
223223
</build>
224+
<profiles>
225+
<!--
226+
This profile lets Eclipse M2E work with the script-maven-plugin.
227+
-->
228+
<profile>
229+
<id>only-eclipse-incubator</id>
230+
<activation>
231+
<property>
232+
<name>m2e.version</name>
233+
</property>
234+
</activation>
235+
<build>
236+
<pluginManagement>
237+
<plugins>
238+
<plugin>
239+
<groupId>org.eclipse.m2e</groupId>
240+
<artifactId>lifecycle-mapping</artifactId>
241+
<version>1.0.0</version>
242+
<configuration>
243+
<lifecycleMappingMetadata>
244+
<pluginExecutions>
245+
<!--
246+
NB: Make Eclipse union the metadata indices on every build; see:
247+
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
248+
-->
249+
<pluginExecution>
250+
<pluginExecutionFilter>
251+
<groupId>com.alexecollins.maven.plugin</groupId>
252+
<artifactId>script-maven-plugin</artifactId>
253+
<versionRange>${script-maven-plugin.version}</versionRange>
254+
<goals>
255+
<goal>execute</goal>
256+
</goals>
257+
</pluginExecutionFilter>
258+
<action>
259+
<execute>
260+
<runOnConfiguration>true</runOnConfiguration>
261+
<!--
262+
NB: You might think we could run the annotations
263+
union script once only, at configuration time.
264+
Unfortunately, when configuration happens in Eclipse,
265+
the plugin annotations have not yet been generated.
266+
So let's redo the union on every incremental build.
267+
That'll show 'em!
268+
-->
269+
<runOnIncremental>true</runOnIncremental>
270+
</execute>
271+
</action>
272+
</pluginExecution>
273+
</pluginExecutions>
274+
</lifecycleMappingMetadata>
275+
</configuration>
276+
</plugin>
277+
</plugins>
278+
</pluginManagement>
279+
</build>
280+
</profile>
281+
</profiles>
224282
</project>

0 commit comments

Comments
 (0)