Fix for Bug 356167 - otdt maven integration fails to build plain maven java project
diff --git a/plugins/org.eclipse.objectteams.mvn/build.properties b/plugins/org.eclipse.objectteams.mvn/build.properties
index dcde528..da1018a 100644
--- a/plugins/org.eclipse.objectteams.mvn/build.properties
+++ b/plugins/org.eclipse.objectteams.mvn/build.properties
@@ -5,4 +5,5 @@
plugin.xml,\
plugin.properties,\
about.html,\
- about.ini
+ about.ini,\
+ lifecycle-mapping-metadata.xml
diff --git a/plugins/org.eclipse.objectteams.mvn/lifecycle-mapping-metadata.xml b/plugins/org.eclipse.objectteams.mvn/lifecycle-mapping-metadata.xml
new file mode 100644
index 0000000..e808b8c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.mvn/lifecycle-mapping-metadata.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ <parameters>
+ <compilerId>jdt</compilerId>
+ </parameters>
+ </pluginExecutionFilter>
+ <action>
+ <configurator>
+ <id>org.eclipse.m2e.jdt.javaConfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+</lifecycleMappingMetadata>
diff --git a/plugins/org.eclipse.objectteams.mvn/plugin.xml b/plugins/org.eclipse.objectteams.mvn/plugin.xml
index 4152fdc..a04c81a 100644
--- a/plugins/org.eclipse.objectteams.mvn/plugin.xml
+++ b/plugins/org.eclipse.objectteams.mvn/plugin.xml
@@ -7,22 +7,6 @@
icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
<basePlugin
icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
- id="org.eclipse.m2e.core">
- </basePlugin>
- <team
- activation="ALL_THREADS"
- class="org.eclipse.objectteams.mvn.internal.LifeCycleMapping"
- icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
- </team>
- <team
- class="org.eclipse.objectteams.mvn.internal.LifeCycleMapping.Context"
- icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
- </team>
- </aspectBinding>
- <aspectBinding
- icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
- <basePlugin
- icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
id="org.eclipse.m2e.jdt">
</basePlugin>
<team
@@ -32,5 +16,8 @@
</team>
</aspectBinding>
</extension>
-
+
+ <extension
+ point="org.eclipse.m2e.core.lifecycleMappingMetadataSource">
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/Configurator.java b/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/Configurator.java
index acc44d9..2aae605 100644
--- a/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/Configurator.java
+++ b/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/Configurator.java
@@ -27,7 +27,7 @@
/**
* When configuring a Java project from its maven pom, check if it's an OT/J project,
- * which we detect by seeing a <code><flavor>otj</flavor></code> element in the
+ * which we detect by seeing a <code><flavor>otj</flavor></code> element in the
* compiler configuration. When an OT/J project is detected add the OTJavaNature
* and update builders accordingly.
*
diff --git a/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/LifeCycleMapping.java b/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/LifeCycleMapping.java
deleted file mode 100644
index 1df3ae4..0000000
--- a/plugins/org.eclipse.objectteams.mvn/src/org/eclipse/objectteams/mvn/internal/LifeCycleMapping.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 GK Software AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Stephan Herrmann - initial API and implementation
- *******************************************************************************/
-package org.eclipse.objectteams.mvn.internal;
-
-import org.eclipse.m2e.core.internal.lifecyclemapping.model.LifecycleMappingMetadataSource;
-import org.osgi.framework.Bundle;
-
-import base org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory;
-import base org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionFilter;
-
-/**
- * This class intercepts reading of org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml
- * so that we replace <code><compilerId>javac</compilerId></code>
- * with <code><compilerId>jdt</compilerId></code>.
- * This seems to be the only way how we can use the jdt compiler via m2e.
- *
- * @author stephan
- */
-@SuppressWarnings("restriction")
-public team class LifeCycleMapping {
-
- final static String M2E_JDT_PLUGIN = "org.eclipse.m2e.jdt";
- final static String COMPILER_ID = "compilerId";
- final static String JDT = "jdt";
-
- /** Cflow-like bracket: work only while reading metadata from org.eclipse.m2e.jdt. */
- protected team class Factory playedBy LifecycleMappingFactory {
-
- @SuppressWarnings("decapsulation")
- void getMetadataSource(Bundle bundle) <- replace LifecycleMappingMetadataSource getMetadataSource(Bundle bundle)
- base when (M2E_JDT_PLUGIN.equals(bundle.getSymbolicName()));
-
- static callin void getMetadataSource(Bundle bundle) {
- within (new Context())
- base.getMetadataSource(bundle);
- }
- }
- /** While reading metadata from org.eclipse.m2e.jdt replace any compilerId with "jdt". */
- protected team class Context {
- protected class Filter playedBy PluginExecutionFilter {
-
- void addParameter(Object key, String value) <- replace void addParameter(Object key, String value)
- base when (COMPILER_ID.equals(key));
-
- callin void addParameter(Object key, String value) {
- base.addParameter(key, JDT);
- }
- }
- }
-}