2

In a current project I am on, we use the flexmojos-plugin to compile a small Flex application. The plugin has all kinds of configuration, but there is no goal configured, and so I am wondering what makes Maven "know" what goals are to be executed or not?

The plugin has something like 25 goals, and as far as I can see, it does not run them all. Therefore I assume there must be some kind of configuration in the plugin that says which goals are to be executed by default - some kind of default execution. I looked at the source for the swf-compile Mojo, and I could not see anything like a "@default" annotation, so where is it configured?

oligofren
  • 20,744
  • 16
  • 93
  • 180
  • It seems it might be answered here: http://stackoverflow.com/questions/5285684/maven-plugin-execution. But to make sure: Am I correct to say that every goal that has a @phase annotation will run in a default execution? – oligofren Apr 24 '12 at 09:06

2 Answers2

1

If you go onto a particular goal than you see page which documents to which lifecycle phase this goal is bound to. For example https://repository.sonatype.org/content/sites/maven-sites/flexmojos/3.8/compile-swc-mojo.html which is bound to the compile lifecycle phase. In the source code you can see to which lifecycle phase the goal is bound by @phase.

Furthermore if you do a simple mvn clean package you can see the goals in the output during the run. Things like the following:

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ xsd ---
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
1

The actual mapping of plugins' goals to lifecycle's phases results from packaging type and is provided within a plugin that defines this packaging (excluding predefined packagings like jar, ejb etc. that are provided by the Maven distribution).

For Flexmojos, you can find it here:
http://www.jarvana.com/jarvana/view/org/sonatype/flexmojos/flexmojos-maven-plugin/4.0-pre-alpha-1/flexmojos-maven-plugin-4.0-pre-alpha-1.jar!/META-INF/plexus/components.xml

This file defines Plexus' components of type LifecycleMapping that provide these mappings for its own packaging types: swc, swf, air.

Michał Kalinowski
  • 16,925
  • 5
  • 35
  • 48