You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ke...@apache.org on 2006/11/16 15:26:33 UTC

svn commit: r475748 - /maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java

Author: kenney
Date: Thu Nov 16 06:26:33 2006
New Revision: 475748

URL: http://svn.apache.org/viewvc?view=rev&rev=475748
Log:
Moved EclipseProjectWriter back its correct locatin, after EclipseClasspathWriter
(jdcaseys merge probably changed this).

This is needed because the EclipseClasspathWriter modifies the EclipseWriterConfig by
adding builders.

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?view=diff&rev=475748&r1=475747&r2=475748
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Thu Nov 16 06:26:33 2006
@@ -94,7 +94,7 @@
 
     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 REQUIRED_PLUGINS_CONTAINER = "org.eclipse.pde.core.requiredPlugins"; //$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$
@@ -113,27 +113,27 @@
      * List of eclipse project natures. By default the
      * <code>org.eclipse.jdt.core.javanature</code> nature plus the needed WTP
      * natures are added. Natures added using this property <strong>replace</strong> the default list.
-     * 
+     *
      * <pre>
      * &lt;projectnatures&gt;
      *    &lt;projectnature&gt;org.eclipse.jdt.core.javanature&lt;/projectnature&gt;
      *    &lt;projectnature&gt;org.eclipse.wst.common.modulecore.ModuleCoreNature&lt;/projectnature&gt;
      * &lt;/projectnatures&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private List projectnatures;
 
     /**
      * List of eclipse project natures to be added to the default ones.
-     * 
+     *
      * <pre>
      * &lt;additionalProjectnatures&gt;
      *    &lt;projectnature&gt;org.springframework.ide.eclipse.core.springnature&lt;/projectnature&gt;
      * &lt;/additionalProjectnatures&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private List additionalProjectnatures;
@@ -141,7 +141,7 @@
     /**
      * List of eclipse build commands. By default the <code>org.eclipse.jdt.core.javabuilder</code> builder plus the needed
      * WTP builders are added. Configuration example:
-     * 
+     *
      * <pre>
      * &lt;buildcommands&gt;
      *    &lt;buildcommand&gt;org.eclipse.wst.common.modulecore.ComponentStructuralBuilder&lt;/buildcommand&gt;
@@ -149,27 +149,27 @@
      *    &lt;buildcommand&gt;org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver&lt;/buildcommand&gt;
      * &lt;/buildcommands&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private List buildcommands;
 
     /**
      * List of eclipse build commands to be added to the default ones.
-     * 
+     *
      * <pre>
      * &lt;additionalBuildcommands&gt;
      *    &lt;buildcommand&gt;org.springframework.ide.eclipse.core.springbuilder&lt;/buildcommand&gt;
      * &lt;/additionalBuildcommands&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private List additionalBuildcommands;
 
     /**
      * List of container classpath entries. By default the <code>org.eclipse.jdt.launching.JRE_CONTAINER</code> classpath
-     * container is added. Configuration example: 
+     * container is added. Configuration example:
      * <pre>
      * &lt;classpathContainers&gt;
      *    &lt;classpathContainer&gt;org.eclipse.jdt.launching.JRE_CONTAINER&lt;/classpathContainer&gt;
@@ -177,7 +177,7 @@
      *    &lt;classpathContainer&gt;org.eclipse.jst.j2ee.internal.web.container/artifact&lt;/classpathContainer&gt;
      * &lt;/classpathContainers&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private List classpathContainers;
@@ -192,7 +192,7 @@
 
     /**
      * Eclipse workspace directory.
-     * 
+     *
      * @parameter expression="${eclipse.workspace}" alias="outputDir"
      */
     private File eclipseProjectDir;
@@ -201,7 +201,7 @@
      * When set to false, the plugin will not create sub-projects and instead
      * reference those sub-projects using the installed package in the local
      * repository
-     * 
+     *
      * @parameter expression="${eclipse.useProjectReferences}" default-value="true"
      * @required
      */
@@ -209,7 +209,7 @@
 
     /**
      * The default output directory
-     * 
+     *
      * @parameter expression="${outputDirectory}" alias="outputDirectory" default-value="${project.build.outputDirectory}"
      * @required
      */
@@ -218,7 +218,7 @@
     /**
      * The version of WTP for which configuration files will be generated.
      * The default value is "none" (don't generate WTP configuration), supported versions are "R7" and "1.0"
-     * 
+     *
      * @parameter expression="${wtpversion}" default-value="none"
      */
     private String wtpversion;
@@ -228,14 +228,14 @@
      * the .project file. Additionally it copies all libraries to a project local directory and
      * references them instead of referencing the files in the local Maven repository. It also
      * ensured that the "Bundle-Classpath" in META-INF/MANIFEST.MF is synchronized.
-     * 
+     *
      * @parameter expression="${eclipse.pde}" default-value="false"
      */
     private boolean pde;
 
     /**
      * The relative path of the manifest file
-     * 
+     *
      * @parameter expression="${eclipse.manifest}" default-value="${basedir}/META-INF/MANIFEST.MF"
      */
     private File manifest;
@@ -243,7 +243,7 @@
     /**
      * Allow to configure additional generic configuration files for eclipse that will be written out to disk when
      * running eclipse:eclipse. FOr each file you can specify the name and the text content.
-     * 
+     *
      * <pre>
      * &lt;additionalConfig&gt;
      *    &lt;file&gt;
@@ -259,7 +259,7 @@
      *    &lt;/file&gt;
      * &lt;/additionalConfig&gt;
      * </pre>
-     * 
+     *
      * @parameter
      */
     private EclipseConfigFile[] additionalConfig;
@@ -273,7 +273,7 @@
      * Not a plugin parameter. Is this a java project?
      */
     private boolean isJavaProject;
-    
+
     protected boolean isJavaProject()
     {
         return isJavaProject;
@@ -594,12 +594,12 @@
         {
             eclipseProjectDir = executedProject.getFile().getParentFile();
         }
-        
+
         if ( !eclipseProjectDir.exists() && !eclipseProjectDir.mkdirs() )
         {
             throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcreatedir", eclipseProjectDir ) ); //$NON-NLS-1$
         }
-        
+
         if ( !eclipseProjectDir.equals( executedProject.getFile().getParentFile() ) )
         {
             if ( !eclipseProjectDir.isDirectory() )
@@ -669,8 +669,6 @@
             new EclipseWtpComponent15Writer().init( getLog(), config ).write();
         }
 
-        new EclipseProjectWriter().init( getLog(), config ).write();
-
         new EclipseSettingsWriter().init( getLog(), config ).write();
 
         if ( isJavaProject )
@@ -684,6 +682,12 @@
             new EclipseOSGiManifestWriter().init( getLog(), config ).write();
         }
 
+        // NOTE: This one MUST be after EclipseClasspathwriter, and possibly others,
+        // since currently EclipseClasspathWriter does some magic to detect nested
+        // output folders and modifies the configuration by adding new (Ant) builders.
+        // So the .project file must be written AFTER those have run!
+        new EclipseProjectWriter().init( getLog(), config ).write();
+
         if ( additionalConfig != null )
         {
             for ( int j = 0; j < additionalConfig.length; j++ )
@@ -727,15 +731,15 @@
         // TODO: add mojo param 'addVersionToProjectName' and if set append
         // -version to the project name.
         config.setEclipseProjectName( project.getArtifactId() );
-        
+
         Set convertedBuildCommands = new LinkedHashSet();
-        
+
         if ( buildcommands != null )
         {
             for ( Iterator it = buildcommands.iterator(); it.hasNext(); )
             {
                 Object cmd = it.next();
-                
+
                 if ( cmd instanceof BuildCommand )
                 {
                     convertedBuildCommands.add( (BuildCommand) cmd );
@@ -746,7 +750,7 @@
                 }
             }
         }
-        
+
         config.setBuildCommands( new LinkedList( convertedBuildCommands ) );
 
         config.setBuildOutputDirectory( buildOutputDirectory );
@@ -771,7 +775,7 @@
      * <b>
      * NOTE: This could change the config!
      * </b>
-     * 
+     *
      * @param config
      * @throws MojoExecutionException
      */