Search code examples
eclipsem2eclipsemaven-compiler-plugin

Why does M2Eclipse execute the maven-compiler-plugin


This is not currently an error, i just want to know how it works that m2e executes the maven-compiler-plugin.

I cannot find any lifecycleMappingMetadata in the pom.xml of the plugin.

Is it possible that the magic takes place in workspace\.metadata\.plugins\org.eclipse.m2e.core\>projectname>.lifecyclemapping?

I cannot really read the file, it seems to be binary.


Solution

  • It depends what you do in Eclipse:

    • If you run a Maven target via a Maven launch configuration from Eclipse, then maven-compiler-plugin gets executed as if you'd run Maven from cmd line (well, mostly).
    • Otherwise, no maven-compiler-plugin is executed; Eclipse runs its own compiler, and ignores the plugin. Please note however that if you configure parameters for the JVM, in pom.xml (in the config section of the plugin), those parameters might be taken in consideration by certain Eclipse plugins (m2e-apt comes to mind, but there might be others)

    I don't understand your statement about lifecycleMappingMetadata; did you expect to find it in pom.xml? If so, then in my experience, maven-compiler-plugin is excepted from it (i.e. you don't need to add explicit lifecycle mapping).