Index: U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
===================================================================
--- U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (revision 462841)
+++ U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (working copy)
@@ -263,6 +263,11 @@
}
else
{
+ // if using m2eclipse then no need to put the M2_REPO stuff in
+ if ( config.isM2eclipse() ) {
+ return;
+ }
+
String fullPath = artifactPath.getPath();
path = M2_REPO + "/" //$NON-NLS-1$
Index: U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
===================================================================
--- U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java (revision 462841)
+++ U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java (working copy)
@@ -71,6 +71,11 @@
private File manifestFile;
/**
+ * M2eclipse ready.
+ */
+ private boolean m2eclipse;
+
+ /**
* PDE mode.
*/
private boolean pde;
@@ -253,6 +258,24 @@
}
/**
+ * Getter for m2eclipse.
+ * @return Returns the m2eclipse.
+ */
+ public boolean isM2eclipse()
+ {
+ return this.m2eclipse;
+ }
+
+ /**
+ * Setter for m2eclipse.
+ * @param m2eclipse The m2eclipse to set.
+ */
+ public void setM2eclipse( boolean m2eclipse )
+ {
+ this.m2eclipse = m2eclipse;
+ }
+
+ /**
* Getter for buildCommands.
* @return Returns the buildCommands.
*/
Index: U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
===================================================================
--- U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (revision 462841)
+++ U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (working copy)
@@ -81,6 +81,8 @@
private static final String BUILDER_PDE_SCHEMA = "org.eclipse.pde.SchemaBuilder"; //$NON-NLS-1$
+ private static final String BUILDER_M2ECLIPSE = "org.maven.ide.eclipse.maven2Builder"; //$NON-NLS-1$
+
private static final String NATURE_WST_MODULE_CORE_NATURE = "org.eclipse.wst.common.modulecore.ModuleCoreNature"; //$NON-NLS-1$
private static final String NATURE_JDT_CORE_JAVA = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
@@ -89,10 +91,14 @@
private static final String NATURE_PDE_PLUGIN = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$
+ private static final String NATURE_M2ECLIPSE = "org.maven.ide.eclipse.maven2Nature"; //$NON-NLS-1$
+
private static final String COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER = "org.eclipse.jdt.launching.JRE_CONTAINER"; //$NON-NLS-1$
private static final String REQUIRED_PLUGINS_CONTAINER = "org.eclipse.pde.core.requiredPlugins"; //$NON-NLS-1$
+ private static final String M2ECLIPSE_DEPENDENCY_CONTAINER = "org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"; //$NON-NLS-1$
+
// warning, order is important for binary search
public static final String[] WTP_SUPPORTED_VERSIONS = new String[] { "1.0", "1.5", "R7", "none" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -205,6 +211,17 @@
private boolean useProjectReferences;
/**
+ * When set to true, the plugin will add the a classpath container for the
+ * the Maven dependencies and will NOT write out the classpaths that are
+ * part of the dependency. The appropriate nature and builder will also be added
+ * to the .project file.
+ *
+ * @parameter expression="${m2eclipse}" default-value="false"
+ * @required
+ */
+ private boolean m2eclipse;
+
+ /**
* The default output directory
*
* @parameter expression="${outputDirectory}" alias="outputDirectory" default-value="${project.build.outputDirectory}"
@@ -380,6 +397,24 @@
}
/**
+ * Getter for m2eclipse.
+ * @return Returns the m2eclipse.
+ */
+ public boolean getM2eclipse()
+ {
+ return this.m2eclipse;
+ }
+
+ /**
+ * Setter for useProjectReferences.
+ * @param useProjectReferences The useProjectReferences to set.
+ */
+ public void setM2eclipse( boolean m2eclipse )
+ {
+ this.m2eclipse = m2eclipse;
+ }
+
+ /**
* Getter for wtpversion.
* @return Returns the wtpversion.
*/
@@ -449,6 +484,11 @@
downloadSources = true;
}
+ if ( m2eclipse )
+ {
+ getLog().info( Messages.getString( "EclipsePlugin.m2eclipse" ) );
+ }
+
if ( Arrays.binarySearch( WTP_SUPPORTED_VERSIONS, wtpversion ) < 0 )
{
throw new MojoExecutionException( Messages
@@ -569,6 +609,7 @@
config.setDeps( deps );
config.setEclipseProjectDirectory( eclipseProjectDir );
config.setLocalRepository( localRepository );
+ config.setM2eclipse( m2eclipse );
config.setManifestFile( manifest );
config.setPde( pde );
config.setProject( project );
@@ -652,6 +693,11 @@
{
projectnatures = new ArrayList();
+ if ( m2eclipse )
+ {
+ projectnatures.add( NATURE_M2ECLIPSE );
+ }
+
if ( wtpVersionFloat >= 1.0f )
{
projectnatures.add( NATURE_WST_FACET_CORE_NATURE ); // WTP 1.0 nature
@@ -688,12 +734,22 @@
{
classpathContainers.add( REQUIRED_PLUGINS_CONTAINER );
}
+
+ if (m2eclipse)
+ {
+ classpathContainers.add( M2ECLIPSE_DEPENDENCY_CONTAINER );
+ }
}
private void fillDefaultBuilders( String packaging )
{
buildcommands = new ArrayList();
+ if ( m2eclipse )
+ {
+ buildcommands.add( BUILDER_M2ECLIPSE );
+ }
+
if ( wtpVersionFloat == 0.7f )
{
buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL ); // WTP 0.7 builder
Index: U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties
===================================================================
--- U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties (revision 462841)
+++ U:/ServiceBench/New System/sandbox/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties (working copy)
@@ -16,6 +16,7 @@
EclipsePlugin.artifactissystemscoped=The artifact has scope ''system''. Artifact id: {0}. System path: {1}
EclipsePlugin.unsupportedwtp=Unsupported WTP version: {0}. This plugin currently supports only the following versions: {1}.
EclipsePlugin.wtpversion=Adding support for WTP version {0}.
+EclipsePlugin.m2eclipse=Adding support for m2eclipse plugin.
EclipsePlugin.missingjrecontainer=You did specify a list of classpath containers without the base org.eclipse.jdt.launching.JRE_CONTAINER.\n If you specify custom classpath containers you should also add org.eclipse.jdt.launching.JRE_CONTAINER to the list
EclipsePlugin.deprecatedpar=Plugin parameter "{0}" is deprecated, please use "{1}"
EclipsePlugin.cantcopyartifact=Can''t copy artifact "{0}".