You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/04/01 17:39:35 UTC

svn commit: r390686 [1/2] - in /maven/plugins/trunk/maven-eclipse-plugin: ./ src/main/java/org/apache/maven/plugin/eclipse/ src/main/java/org/apache/maven/plugin/eclipse/writers/ src/main/java/org/apache/maven/plugin/ide/ src/main/resources/org/apache/...

Author: fgiust
Date: Sat Apr  1 07:39:33 2006
New Revision: 390686

URL: http://svn.apache.org/viewcvs?rev=390686&view=rev
Log:
Major refactoring of the plugin, aiming to spin off any generic IDE related util that can be used by others similar mojos (e.g. the Idea one). All the common stuff is now done in a generic abstract IdeSupportMojo which takes care of manual dependency resolution, source and javadocs downloading, sorting of referenced projects, handling of common messages and flags.
Integrating some bits from the Idea plugin for artifact resolution, and fix it so it doesn't require reactor projects to have installed artifacts at all.
All the existing unit tests work without problems after the refactoring (also with the removal of a reactor artifact from the test repo). Test #7 is commented out at the moment since it randomically fails due to the random order used in .classpath and .wtpmodules (test does line by line comparison).

Added:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java   (with props)
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java   (with props)
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java   (with props)
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/Messages.java   (with props)
    maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/
    maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
Removed:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseUtils.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/m2repo/eclipsetest/module-1/
Modified:
    maven/plugins/trunk/maven-eclipse-plugin/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseResourceWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractWtpResourceWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponentWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpFacetsWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpmodulesWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/m2repo/   (props changed)
    maven/plugins/trunk/maven-eclipse-plugin/src/test/m2repo/junit/junit/   (props changed)

Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/pom.xml?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/pom.xml Sat Apr  1 07:39:33 2006
@@ -1,4 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <artifactId>maven-plugins</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
@@ -34,7 +36,7 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
-      <version>2.0</version>
+      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -43,20 +45,13 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-settings</artifactId>
-      <version>2.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
       <artifactId>maven-model</artifactId>
       <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact-manager</artifactId>
-      <version>2.0</version>
-      <scope>test</scope>
+      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -65,19 +60,19 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.1</version>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
       <version>1.0.5</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
+      <artifactId>maven-settings</artifactId>
       <version>2.0.1</version>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
-      <version>1.0-alpha-9</version>
       <scope>test</scope>
     </dependency>
   </dependencies>

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- 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 Sat Apr  1 07:39:33 2006
@@ -19,24 +19,22 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.eclipse.writers.EclipseClasspathWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseProjectWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseSettingsWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseWtpComponentWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseWtpFacetsWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseWtpmodulesWriter;
+import org.apache.maven.plugin.ide.AbstractIdeSupportMojo;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -55,11 +53,10 @@
  * @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
  * @version $Id$
  * @goal eclipse
- * @requiresDependencyResolution test
- * @execute phase="generate-test-resources"
+ * @execute phase="generate-resources"
  */
 public class EclipsePlugin
-    extends AbstractMojo
+    extends AbstractIdeSupportMojo
 {
 
     private static final String NATURE_WST_FACET_CORE_NATURE = "org.eclipse.wst.common.project.facet.core.nature"; //$NON-NLS-1$
@@ -94,71 +91,6 @@
     private static final String POM_ELT_GROUP_ID = "groupId"; //$NON-NLS-1$
 
     /**
-     * The project whose project files to create.
-     * 
-     * @parameter expression="${project}"
-     * @required
-     * @readonly
-     */
-    private MavenProject project;
-
-    /**
-     * The currently executed project (can be a reactor project).
-     * 
-     * @parameter expression="${executedProject}"
-     * @readonly
-     */
-    private MavenProject executedProject;
-
-    /**
-     * Local maven repository.
-     * 
-     * @parameter expression="${localRepository}"
-     * @required
-     * @readonly
-     */
-    private ArtifactRepository localRepository;
-
-    /**
-     * If the executed project is a reactor project, this will contains the full
-     * list of projects in the reactor.
-     * 
-     * @parameter expression="${reactorProjects}"
-     * @required
-     * @readonly
-     */
-    private List reactorProjects;
-
-    /**
-     * Artifact resolver, needed to download source jars for inclusion in
-     * classpath.
-     * 
-     * @component role="org.apache.maven.artifact.resolver.ArtifactResolver"
-     * @required
-     * @readonly
-     */
-    private ArtifactResolver artifactResolver;
-
-    /**
-     * Artifact factory, needed to download source jars for inclusion in
-     * classpath.
-     * 
-     * @component role="org.apache.maven.artifact.factory.ArtifactFactory"
-     * @required
-     * @readonly
-     */
-    private ArtifactFactory artifactFactory;
-
-    /**
-     * Remote repositories which will be searched for source attachments.
-     * 
-     * @parameter expression="${project.remoteArtifactRepositories}"
-     * @required
-     * @readonly
-     */
-    private List remoteArtifactRepositories;
-
-    /**
      * List of eclipse project natures. By default the
      * <code>org.eclipse.jdt.core.javanature</code> nature plus the needed WTP
      * natures are added.
@@ -206,12 +138,10 @@
     private List classpathContainers;
 
     /**
-     * Enables/disables the downloading of source attachments. Defaults to
-     * false.
-     * 
      * @parameter expression="${eclipse.downloadSources}"
+     * @deprecated use <code>downloadSources</code>
      */
-    private boolean downloadSources;
+    private boolean eclipseDownloadSources;
 
     /**
      * Eclipse workspace directory.
@@ -246,11 +176,6 @@
     private String wtpversion;
 
     /**
-     * Not a plugin parameter. Collect missing source artifact for the final report.
-     */
-    private List missingSourceArtifacts = new ArrayList();
-
-    /**
      * Not a plugin parameter. Are we working with wtp r7?
      */
     private boolean wtpR7;
@@ -261,12 +186,147 @@
     private boolean wtp10;
 
     /**
+     * Getter for <code>buildcommands</code>.
+     * @return Returns the buildcommands.
+     */
+    public List getBuildcommands()
+    {
+        return this.buildcommands;
+    }
+
+    /**
+     * Setter for <code>buildcommands</code>.
+     * @param buildcommands The buildcommands to set.
+     */
+    public void setBuildcommands( List buildcommands )
+    {
+        this.buildcommands = buildcommands;
+    }
+
+    /**
+     * Getter for <code>buildOutputDirectory</code>.
+     * @return Returns the buildOutputDirectory.
+     */
+    public File getBuildOutputDirectory()
+    {
+        return this.buildOutputDirectory;
+    }
+
+    /**
+     * Setter for <code>buildOutputDirectory</code>.
+     * @param buildOutputDirectory The buildOutputDirectory to set.
+     */
+    public void setBuildOutputDirectory( File buildOutputDirectory )
+    {
+        this.buildOutputDirectory = buildOutputDirectory;
+    }
+
+    /**
+     * Getter for <code>classpathContainers</code>.
+     * @return Returns the classpathContainers.
+     */
+    public List getClasspathContainers()
+    {
+        return this.classpathContainers;
+    }
+
+    /**
+     * Setter for <code>classpathContainers</code>.
+     * @param classpathContainers The classpathContainers to set.
+     */
+    public void setClasspathContainers( List classpathContainers )
+    {
+        this.classpathContainers = classpathContainers;
+    }
+
+    /**
+     * Getter for <code>eclipseProjectDir</code>.
+     * @return Returns the eclipseProjectDir.
+     */
+    public File getEclipseProjectDir()
+    {
+        return this.eclipseProjectDir;
+    }
+
+    /**
+     * Setter for <code>eclipseProjectDir</code>.
+     * @param eclipseProjectDir The eclipseProjectDir to set.
+     */
+    public void setEclipseProjectDir( File eclipseProjectDir )
+    {
+        this.eclipseProjectDir = eclipseProjectDir;
+    }
+
+    /**
+     * Getter for <code>projectnatures</code>.
+     * @return Returns the projectnatures.
+     */
+    public List getProjectnatures()
+    {
+        return this.projectnatures;
+    }
+
+    /**
+     * Setter for <code>projectnatures</code>.
+     * @param projectnatures The projectnatures to set.
+     */
+    public void setProjectnatures( List projectnatures )
+    {
+        this.projectnatures = projectnatures;
+    }
+
+    /**
+     * Getter for <code>useProjectReferences</code>.
+     * @return Returns the useProjectReferences.
+     */
+    public boolean getUseProjectReferences()
+    {
+        return this.useProjectReferences;
+    }
+
+    /**
+     * Setter for <code>useProjectReferences</code>.
+     * @param useProjectReferences The useProjectReferences to set.
+     */
+    public void setUseProjectReferences( boolean useProjectReferences )
+    {
+        this.useProjectReferences = useProjectReferences;
+    }
+
+    /**
+     * Getter for <code>wtpversion</code>.
+     * @return Returns the wtpversion.
+     */
+    public String getWtpversion()
+    {
+        return this.wtpversion;
+    }
+
+    /**
+     * Setter for <code>wtpversion</code>.
+     * @param wtpversion The wtpversion to set.
+     */
+    public void setWtpversion( String wtpversion )
+    {
+        this.wtpversion = wtpversion;
+    }
+
+    /**
      * @see org.apache.maven.plugin.Mojo#execute()
      */
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
+    public boolean setup()
+        throws MojoExecutionException
     {
 
+        if ( eclipseDownloadSources )
+        {
+            // deprecated warning
+            getLog().warn( Messages.getString( "EclipsePlugin.deprecatedpar", new Object[] { //$NON-NLS-1$
+                                               "eclipse.downloadSources", //$NON-NLS-1$
+                                                   "downloadSources" } ) ); //$NON-NLS-1$
+            downloadSources = true;
+        }
+
         if ( Arrays.binarySearch( WTP_SUPPORTED_VERSIONS, wtpversion ) < 0 )
         {
             throw new MojoExecutionException( Messages
@@ -287,12 +347,6 @@
             getLog().info( Messages.getString( "EclipsePlugin.wtpversion", wtpversion ) );
         }
 
-        if ( executedProject == null )
-        {
-            // backwards compat with alpha-2 only
-            executedProject = project;
-        }
-
         String packaging = executedProject.getPackaging();
 
         // validate sanity of the current m2 project
@@ -307,7 +361,7 @@
         if ( "pom".equals( packaging ) && eclipseProjectDir == null ) //$NON-NLS-1$
         {
             getLog().info( Messages.getString( "EclipsePlugin.pompackaging" ) ); //$NON-NLS-1$
-            return;
+            return false;
         }
 
         if ( eclipseProjectDir == null )
@@ -350,92 +404,55 @@
             classpathContainers.add( 0, COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER );
         }
 
-        // end defaults
-
         // ready to start
-        write();
+        return true;
     }
 
-    public void write()
+    public void writeConfiguration( IdeDependency[] deps )
         throws MojoExecutionException
     {
         File projectBaseDir = executedProject.getFile().getParentFile();
 
-        // build the list of referenced ARTIFACTS produced by reactor projects
-        List reactorArtifacts;
-        if ( useProjectReferences )
-        {
-            reactorArtifacts = EclipseUtils.resolveReactorArtifacts( project, reactorProjects );
-        }
-        else
-        {
-            reactorArtifacts = Collections.EMPTY_LIST;
-        }
-
         // build a list of UNIQUE source dirs (both src and resources) to be
         // used in classpath and wtpmodules
-        EclipseSourceDir[] sourceDirs = EclipseUtils.buildDirectoryList( executedProject, eclipseProjectDir, getLog(),
-                                                                         buildOutputDirectory );
-
-        Collection artifacts = prepareArtifacts();
-
-        downloadSourceArtifacts( artifacts, reactorArtifacts );
+        EclipseSourceDir[] sourceDirs = buildDirectoryList( executedProject, eclipseProjectDir, buildOutputDirectory );
 
         if ( wtpR7 )
         {
-            new EclipseWtpmodulesWriter( getLog(), eclipseProjectDir, project, artifacts ).write( reactorArtifacts,
-                                                                                                  sourceDirs,
-                                                                                                  localRepository,
-                                                                                                  buildOutputDirectory );
+            new EclipseWtpmodulesWriter( getLog(), eclipseProjectDir, project, deps ).write( sourceDirs,
+                                                                                             localRepository,
+                                                                                             buildOutputDirectory );
         }
         else if ( wtp10 )
         {
-            new EclipseWtpFacetsWriter( getLog(), eclipseProjectDir, project, artifacts ).write( reactorArtifacts,
-                                                                                                 sourceDirs,
-                                                                                                 localRepository,
-                                                                                                 buildOutputDirectory );
-            new EclipseWtpComponentWriter( getLog(), eclipseProjectDir, project, artifacts )
-                .write( reactorArtifacts, sourceDirs, localRepository, buildOutputDirectory );
-        }
-
-        new EclipseProjectWriter( getLog(), eclipseProjectDir, project ).write( projectBaseDir, executedProject,
-                                                                                reactorArtifacts, projectnatures,
-                                                                                buildcommands );
-
-        new EclipseSettingsWriter( getLog(), eclipseProjectDir, project ).write();
-
-        new EclipseClasspathWriter( getLog(), eclipseProjectDir, project, artifacts ).write( projectBaseDir,
-                                                                                             reactorArtifacts,
-                                                                                             sourceDirs,
-                                                                                             classpathContainers,
-                                                                                             localRepository,
-                                                                                             artifactResolver,
-                                                                                             artifactFactory,
-                                                                                             buildOutputDirectory );
+            new EclipseWtpFacetsWriter( getLog(), eclipseProjectDir, project, deps ).write( sourceDirs,
+                                                                                            localRepository,
+                                                                                            buildOutputDirectory );
+            new EclipseWtpComponentWriter( getLog(), eclipseProjectDir, project, deps ).write( sourceDirs,
+                                                                                               localRepository,
+                                                                                               buildOutputDirectory );
+        }
+
+        new EclipseProjectWriter( getLog(), eclipseProjectDir, project, deps ).write( projectBaseDir, executedProject,
+                                                                                      projectnatures, buildcommands );
+
+        new EclipseSettingsWriter( getLog(), eclipseProjectDir, project, deps ).write();
+
+        new EclipseClasspathWriter( getLog(), eclipseProjectDir, project, deps ).write( projectBaseDir, sourceDirs,
+                                                                                        classpathContainers,
+                                                                                        localRepository,
+                                                                                        buildOutputDirectory );
 
-        reportMissingSources();
-
-        getLog().info(
-                       Messages
-                           .getString( "EclipsePlugin.wrote", //$NON-NLS-1$
-                                       new Object[] { project.getArtifactId(), eclipseProjectDir.getAbsolutePath() } ) );
-    }
-
-    private Collection prepareArtifacts()
-    {
-        Collection artifacts = project.getTestArtifacts();
-        EclipseUtils.fixMissingOptionalArtifacts( artifacts, project.getDependencyArtifacts(), localRepository,
-                                                  artifactResolver, remoteArtifactRepositories, getLog() );
-        EclipseUtils.fixSystemScopeArtifacts( artifacts, project.getDependencies() );
-        return artifacts;
+        getLog().info( Messages.getString( "EclipsePlugin.wrote", new Object[] { //$NON-NLS-1$
+                                           project.getArtifactId(), eclipseProjectDir.getAbsolutePath() } ) );
     }
 
     private void assertNotEmpty( String string, String elementName )
-        throws MojoFailureException
+        throws MojoExecutionException
     {
         if ( string == null )
         {
-            throw new MojoFailureException( Messages.getString( "EclipsePlugin.missingelement", elementName ) ); //$NON-NLS-1$
+            throw new MojoExecutionException( Messages.getString( "EclipsePlugin.missingelement", elementName ) ); //$NON-NLS-1$
         }
     }
 
@@ -486,225 +503,124 @@
         }
     }
 
-    private void downloadSourceArtifacts( Collection artifacts, Collection reactorArtifacts )
+    public EclipseSourceDir[] buildDirectoryList( MavenProject project, File basedir, File buildOutputDirectory )
         throws MojoExecutionException
     {
-        // if downloadSources is off, just check local repository for reporting
-        // missing jars
-        List remoteRepos = downloadSources ? remoteArtifactRepositories : new ArrayList( 0 );
-        for ( Iterator it = artifacts.iterator(); it.hasNext(); )
-        {
-            Artifact artifact = (Artifact) it.next();
-
-            if ( reactorArtifacts.contains( artifact ) )
-            {
-                // source artifact not needed
-                continue;
-            }
-
-            // source artifact: use the "sources" classifier added by the source plugin
-            Artifact sourceArtifact = EclipseUtils.resolveArtifactWithClassifier( artifact, "sources", localRepository, //$NON-NLS-1$
-                                                                                  artifactResolver, artifactFactory,
-                                                                                  remoteRepos );
-
-            if ( !sourceArtifact.isResolved() )
-            {
-                // try using a plain javadoc jar if the source jar is not available
-                EclipseUtils.resolveArtifactWithClassifier( artifact, "javadoc", localRepository, artifactResolver, //$NON-NLS-1$
-                                                            artifactFactory, remoteRepos );
-
-                missingSourceArtifacts.add( artifact );
-            }
-        }
-    }
+        File projectBaseDir = project.getFile().getParentFile();
 
-    private void reportMissingSources()
-    {
-        if ( missingSourceArtifacts.isEmpty() )
-        {
-            return;
-        }
+        // avoid duplicated entries
+        Set directories = new TreeSet();
 
-        StringBuffer msg = new StringBuffer();
+        extractSourceDirs( directories, project.getCompileSourceRoots(), basedir, projectBaseDir, false, null );
 
-        if ( downloadSources )
-        {
-            msg.append( Messages.getString( "EclipseClasspathWriter.sourcesnotavailable" ) ); //$NON-NLS-1$
-        }
-        else
-        {
-            msg.append( Messages.getString( "EclipseClasspathWriter.sourcesnotdownloaded" ) ); //$NON-NLS-1$
-        }
+        extractResourceDirs( directories, project.getBuild().getResources(), project, basedir, projectBaseDir, false,
+                             null );
 
-        for ( Iterator it = missingSourceArtifacts.iterator(); it.hasNext(); )
+        // If using the standard output location, don't mix the test output into it.
+        String testOutput = null;
+        boolean useFixedOutputDir = !buildOutputDirectory.equals( new File( project.getBuild().getOutputDirectory() ) );
+        if ( !useFixedOutputDir )
         {
-            Artifact art = (Artifact) it.next();
-            msg.append( Messages.getString( "EclipseClasspathWriter.sourcesmissingitem", art.getId() ) ); //$NON-NLS-1$
+            testOutput = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, new File( project.getBuild()
+                .getTestOutputDirectory() ), false );
         }
-        msg.append( "\n" ); //$NON-NLS-1$
-
-        getLog().info( msg ); //$NON-NLS-1$
-
-    }
-
-    public ArtifactFactory getArtifactFactory()
-    {
-        return artifactFactory;
-    }
-
-    public void setArtifactFactory( ArtifactFactory artifactFactory )
-    {
-        this.artifactFactory = artifactFactory;
-    }
 
-    public ArtifactResolver getArtifactResolver()
-    {
-        return artifactResolver;
-    }
-
-    public void setArtifactResolver( ArtifactResolver artifactResolver )
-    {
-        this.artifactResolver = artifactResolver;
-    }
-
-    public List getBuildcommands()
-    {
-        return buildcommands;
-    }
-
-    public void setBuildcommands( List buildcommands )
-    {
-        this.buildcommands = buildcommands;
-    }
-
-    public File getBuildOutputDirectory()
-    {
-        return buildOutputDirectory;
-    }
+        extractSourceDirs( directories, project.getTestCompileSourceRoots(), basedir, projectBaseDir, true, testOutput );
 
-    public void setBuildOutputDirectory( File buildOutputDirectory )
-    {
-        this.buildOutputDirectory = buildOutputDirectory;
-    }
-
-    public List getClasspathContainers()
-    {
-        return classpathContainers;
-    }
-
-    public void setClasspathContainers( List classpathContainers )
-    {
-        this.classpathContainers = classpathContainers;
-    }
+        extractResourceDirs( directories, project.getBuild().getTestResources(), project, basedir, projectBaseDir,
+                             true, testOutput );
 
-    public boolean isDownloadSources()
-    {
-        return downloadSources;
+        return (EclipseSourceDir[]) directories.toArray( new EclipseSourceDir[directories.size()] );
     }
 
-    public void setDownloadSources( boolean downloadSources )
-    {
-        this.downloadSources = downloadSources;
-    }
-
-    public File getEclipseProjectDir()
-    {
-        return eclipseProjectDir;
-    }
-
-    public void setEclipseProjectDir( File eclipseProjectDir )
-    {
-        this.eclipseProjectDir = eclipseProjectDir;
-    }
-
-    public MavenProject getExecutedProject()
-    {
-        return executedProject;
-    }
-
-    public void setExecutedProject( MavenProject executedProject )
-    {
-        this.executedProject = executedProject;
-    }
-
-    public ArtifactRepository getLocalRepository()
-    {
-        return localRepository;
-    }
-
-    public void setLocalRepository( ArtifactRepository localRepository )
-    {
-        this.localRepository = localRepository;
-    }
-
-    public List getMissingSourceArtifacts()
+    private static void extractSourceDirs( Set directories, List sourceRoots, File basedir, File projectBaseDir,
+                                           boolean test, String output )
+        throws MojoExecutionException
     {
-        return missingSourceArtifacts;
-    }
+        for ( Iterator it = sourceRoots.iterator(); it.hasNext(); )
+        {
 
-    public void setMissingSourceArtifacts( List missingSourceArtifacts )
-    {
-        this.missingSourceArtifacts = missingSourceArtifacts;
-    }
+            File sourceRootFile = new File( (String) it.next() );
 
-    public MavenProject getProject()
-    {
-        return project;
-    }
+            if ( sourceRootFile.isDirectory() )
+            {
+                String sourceRoot = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRootFile, !projectBaseDir
+                    .equals( basedir ) );
 
-    public void setProject( MavenProject project )
-    {
-        this.project = project;
+                directories.add( new EclipseSourceDir( sourceRoot, output, test, null, null ) );
+            }
+        }
     }
 
-    public List getProjectnatures()
+    private void extractResourceDirs( Set directories, List resources, MavenProject project, File basedir,
+                                      File projectBaseDir, boolean test, String output )
+        throws MojoExecutionException
     {
-        return projectnatures;
-    }
+        for ( Iterator it = resources.iterator(); it.hasNext(); )
+        {
+            Resource resource = (Resource) it.next();
+            String includePattern = null;
+            String excludePattern = null;
 
-    public void setProjectnatures( List projectnatures )
-    {
-        this.projectnatures = projectnatures;
-    }
+            if ( resource.getIncludes().size() != 0 )
+            {
+                // @todo includePattern = ?
+                getLog().warn( Messages.getString( "EclipsePlugin.includenotsupported" ) ); //$NON-NLS-1$
+            }
 
-    public List getReactorProjects()
-    {
-        return reactorProjects;
-    }
+            if ( resource.getExcludes().size() != 0 )
+            {
+                // @todo excludePattern = ?
+                getLog().warn( Messages.getString( "EclipsePlugin.excludenotsupported" ) ); //$NON-NLS-1$
+            }
 
-    public void setReactorProjects( List reactorProjects )
-    {
-        this.reactorProjects = reactorProjects;
-    }
+            // Example of setting include/exclude patterns for future reference.
+            //
+            // TODO: figure out how to merge if the same dir is specified twice
+            // with different in/exclude patterns. We can't write them now,
+            // since only the the first one would be included.
+            //
+            // if ( resource.getIncludes().size() != 0 )
+            // {
+            // writer.addAttribute(
+            // "including", StringUtils.join( resource.getIncludes().iterator(),
+            // "|" )
+            // );
+            // }
+            //
+            // if ( resource.getExcludes().size() != 0 )
+            // {
+            // writer.addAttribute(
+            // "excluding", StringUtils.join( resource.getExcludes().iterator(),
+            // "|" )
+            // );
+            // }
 
-    public List getRemoteArtifactRepositories()
-    {
-        return remoteArtifactRepositories;
-    }
+            if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
+            {
+                output = resource.getTargetPath();
+            }
 
-    public void setRemoteArtifactRepositories( List remoteArtifactRepositories )
-    {
-        this.remoteArtifactRepositories = remoteArtifactRepositories;
-    }
+            File resourceDirectory = new File( resource.getDirectory() );
 
-    public boolean isUseProjectReferences()
-    {
-        return useProjectReferences;
-    }
+            if ( !resourceDirectory.exists() || !resourceDirectory.isDirectory() )
+            {
+                continue;
+            }
 
-    public void setUseProjectReferences( boolean useProjectReferences )
-    {
-        this.useProjectReferences = useProjectReferences;
-    }
+            String resourceDir = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, resourceDirectory, !projectBaseDir
+                .equals( basedir ) );
 
-    public String getWtpversion()
-    {
-        return wtpversion;
-    }
+            if ( output != null )
+            {
+                File outputFile = new File( projectBaseDir, output );
+                // create output dir if it doesn't exist
+                outputFile.mkdirs();
+                output = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, outputFile, false );
+            }
 
-    public void setWtpversion( String wtpversion )
-    {
-        this.wtpversion = wtpversion;
+            directories.add( new EclipseSourceDir( resourceDir, output, test, includePattern, excludePattern ) );
+        }
     }
 
 }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseResourceWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseResourceWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseResourceWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseResourceWriter.java Sat Apr  1 07:39:33 2006
@@ -5,6 +5,7 @@
 
 import java.io.File;
 
+import org.apache.maven.plugin.ide.IdeDependency;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 
@@ -23,16 +24,19 @@
 
     private MavenProject project;
 
+    protected IdeDependency[] deps;
+
     /**
      * @param log
      * @param eclipseProjectDir
      * @param project
      */
-    public AbstractEclipseResourceWriter( Log log, File eclipseProjectDir, MavenProject project )
+    public AbstractEclipseResourceWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
         this.log = log;
         this.eclipseProjectDir = eclipseProjectDir;
         this.project = project;
+        this.deps = deps;
     }
 
     /**

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractWtpResourceWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractWtpResourceWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractWtpResourceWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractWtpResourceWriter.java Sat Apr  1 07:39:33 2006
@@ -4,17 +4,13 @@
 package org.apache.maven.plugin.eclipse.writers;
 
 import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
@@ -63,15 +59,9 @@
 
     protected static final String ARTIFACT_MAVEN_WAR_PLUGIN = "maven-war-plugin"; //$NON-NLS-1$
 
-    /**
-     * Dependencies for our project.
-     */
-    private Collection artifacts;
-
-    public AbstractWtpResourceWriter( Log log, File eclipseProjectDir, MavenProject project, Collection artifacts )
+    public AbstractWtpResourceWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project );
-        this.artifacts = artifacts;
+        super( log, eclipseProjectDir, project, deps );
     }
 
     /**
@@ -79,22 +69,21 @@
      * 
      * @return
      */
-    protected Collection getDependencies()
+    protected IdeDependency[] getDependencies()
     {
-        return this.artifacts;
+        return this.deps;
     }
 
     /**
      * Common elements of configuration are handled here.
      * 
-     * @param referencedReactorArtifacts
      * @param sourceDirs
      * @param localRepository
      * @param buildOutputDirectory
      * @throws MojoExecutionException
      */
-    public abstract void write( List referencedReactorArtifacts, EclipseSourceDir[] sourceDirs,
-                               ArtifactRepository localRepository, File buildOutputDirectory )
+    public abstract void write( EclipseSourceDir[] sourceDirs, ArtifactRepository localRepository,
+                                File buildOutputDirectory )
         throws MojoExecutionException;
 
     /**
@@ -104,7 +93,7 @@
      * @throws MojoExecutionException
      */
     protected void writeModuleTypeAccordingToPackaging( MavenProject project, XMLWriter writer, String packaging,
-                                                       File buildOutputDirectory )
+                                                        File buildOutputDirectory )
         throws MojoExecutionException
     {
         if ( "war".equals( packaging ) ) //$NON-NLS-1$
@@ -141,7 +130,7 @@
             writer.startElement( ELT_PROPERTY );
             writer.addAttribute( ATTR_NAME, "java-output-path" ); //$NON-NLS-1$ 
             writer.addAttribute( ATTR_VALUE, "/" + //$NON-NLS-1$ 
-                EclipseUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
+                IdeUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
             writer.endElement();
 
         }
@@ -161,7 +150,7 @@
             writer.startElement( ELT_PROPERTY );
             writer.addAttribute( ATTR_NAME, "java-output-path" ); //$NON-NLS-1$ 
             writer.addAttribute( ATTR_VALUE, "/" + //$NON-NLS-1$ 
-                EclipseUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
+                IdeUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
             writer.endElement();
         }
     }
@@ -171,25 +160,23 @@
      * 
      * @param writer
      * @param artifact
-     * @param referencedReactorProjects
      * @param localRepository
      * @param basedir
      * @throws MojoExecutionException
      */
-    protected void addDependency( XMLWriter writer, Artifact artifact, List referencedReactorProjects,
-                                 ArtifactRepository localRepository, File basedir )
+    protected void addDependency( XMLWriter writer, IdeDependency dep, ArtifactRepository localRepository, File basedir )
         throws MojoExecutionException
     {
         String handle;
 
-        if ( referencedReactorProjects.contains( artifact ) )
+        if ( dep.isReferencedProject() )
         {
             // <dependent-module deploy-path="/WEB-INF/lib"
             // handle="module:/resource/artifactid/artifactid">
             // <dependency-type>uses</dependency-type>
             // </dependent-module>
 
-            handle = "module:/resource/" + artifact.getArtifactId() + "/" + artifact.getArtifactId(); //$NON-NLS-1$ //$NON-NLS-2$
+            handle = "module:/resource/" + dep.getArtifactId() + "/" + dep.getArtifactId(); //$NON-NLS-1$ //$NON-NLS-2$
         }
         else
         {
@@ -198,28 +185,28 @@
             // <dependency-type>uses</dependency-type>
             // </dependent-module>
 
-            File artifactPath = artifact.getFile();
+            File artifactPath = dep.getFile();
 
             if ( artifactPath == null )
             {
-                getLog().error( Messages.getString( "EclipsePlugin.artifactpathisnull", artifact.getId() ) ); //$NON-NLS-1$
+                getLog().error( Messages.getString( "EclipsePlugin.artifactpathisnull", dep.getId() ) ); //$NON-NLS-1$
                 return;
             }
 
             String fullPath = artifactPath.getPath();
             File repoFile = new File( fullPath );
 
-            if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+            if ( dep.isSystemScoped() )
             {
                 handle = "module:/classpath/lib/" //$NON-NLS-1$
-                    + EclipseUtils.toRelativeAndFixSeparator( basedir, repoFile, false );
+                    + IdeUtils.toRelativeAndFixSeparator( basedir, repoFile, false );
             }
             else
             {
                 File localRepositoryFile = new File( localRepository.getBasedir() );
 
                 handle = "module:/classpath/var/M2_REPO/" //$NON-NLS-1$
-                    + EclipseUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
+                    + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
             }
         }
 
@@ -235,25 +222,22 @@
         writer.endElement();
     }
 
-    protected void writeWarOrEarResources( XMLWriter writer, MavenProject project, List referencedReactorArtifacts,
-                                          ArtifactRepository localRepository )
+    protected void writeWarOrEarResources( XMLWriter writer, MavenProject project, ArtifactRepository localRepository )
         throws MojoExecutionException
     {
 
-        ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
-
         // dependencies
-        for ( Iterator it = artifacts.iterator(); it.hasNext(); )
+        for ( int j = 0; j < deps.length; j++ )
         {
-            Artifact artifact = (Artifact) it.next();
-            String type = artifact.getType();
+            IdeDependency dep = deps[j];
+            String type = dep.getType();
 
-            // NB war is needed for ear projects, we suppose nobody adds a war
-            // dependency to a war/jar project
-            if ( ( scopeFilter.include( artifact ) || Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+            // NB war is needed for ear projects, we suppose nobody adds a war dependency to a war/jar project
+            // exclude test and provided deps
+            if ( ( !dep.isTestDependency() && !dep.isProvided() )
                 && ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) || "war".equals( type ) ) ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
             {
-                addDependency( writer, artifact, referencedReactorArtifacts, localRepository, getProject().getBasedir() );
+                addDependency( writer, dep, localRepository, getProject().getBasedir() );
             }
         }
     }
@@ -262,12 +246,12 @@
     {
         String[] artifactNames = new String[] { "servlet-api", "servletapi", "geronimo-spec-servlet" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
-        String version = EclipseUtils.getDependencyVersion( artifactNames, getProject().getArtifacts(), 3 );
+        String version = IdeUtils.getDependencyVersion( artifactNames, getProject().getArtifacts(), 3 );
         if ( version == null )
         {
             // none of the above specified matched, try geronimo-spec-j2ee
             artifactNames = new String[] { "geronimo-spec-j2ee" }; //$NON-NLS-1$
-            version = EclipseUtils.getDependencyVersion( artifactNames, getProject().getArtifacts(), 3 );
+            version = IdeUtils.getDependencyVersion( artifactNames, getProject().getArtifacts(), 3 );
             if ( version != null )
             {
                 String j2eeMinorVersion = StringUtils.substring( version, 2, 3 );
@@ -294,10 +278,10 @@
 
     protected String resolveJavaVersion()
     {
-        String version = EclipseUtils.getPluginSetting( getProject(), "maven-compiler-plugin", "target", null ); //$NON-NLS-1$ //$NON-NLS-2$
+        String version = IdeUtils.getPluginSetting( getProject(), "maven-compiler-plugin", "target", null ); //$NON-NLS-1$ //$NON-NLS-2$
         if ( version == null )
         {
-            EclipseUtils.getPluginSetting( getProject(), "maven-compiler-plugin", "source", null ); //$NON-NLS-1$ //$NON-NLS-2$
+            IdeUtils.getPluginSetting( getProject(), "maven-compiler-plugin", "source", null ); //$NON-NLS-1$ //$NON-NLS-2$
         }
 
         if ( "1.5".equals( version ) || "5".equals( version ) ) //$NON-NLS-1$ //$NON-NLS-2$

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java Sat Apr  1 07:39:33 2006
@@ -19,18 +19,15 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
@@ -94,20 +91,13 @@
      */
     private static final String FILE_DOT_CLASSPATH = ".classpath"; //$NON-NLS-1$
 
-    /**
-     * Dependencies for our project.
-     */
-    private Collection artifacts;
-
-    public EclipseClasspathWriter( Log log, File eclipseProjectDir, MavenProject project, Collection artifacts )
+    public EclipseClasspathWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project );
-        this.artifacts = artifacts;
+        super( log, eclipseProjectDir, project, deps );
     }
 
-    public void write( File projectBaseDir, List referencedReactorArtifacts, EclipseSourceDir[] sourceDirs,
-                      List classpathContainers, ArtifactRepository localRepository, ArtifactResolver artifactResolver,
-                      ArtifactFactory artifactFactory, File buildOutputDirectory )
+    public void write( File projectBaseDir, EclipseSourceDir[] sourceDirs, List classpathContainers,
+                       ArtifactRepository localRepository, File buildOutputDirectory )
         throws MojoExecutionException
     {
 
@@ -153,8 +143,8 @@
 
         writer.startElement( ELT_CLASSPATHENTRY );
         writer.addAttribute( ATTR_KIND, ATTR_OUTPUT );
-        writer.addAttribute( ATTR_PATH, EclipseUtils.toRelativeAndFixSeparator( projectBaseDir, buildOutputDirectory,
-                                                                                false ) );
+        writer.addAttribute( ATTR_PATH, IdeUtils
+            .toRelativeAndFixSeparator( projectBaseDir, buildOutputDirectory, false ) );
         writer.endElement();
 
         // ----------------------------------------------------------------------
@@ -173,13 +163,13 @@
         // The dependencies
         // ----------------------------------------------------------------------
 
-        for ( Iterator it = artifacts.iterator(); it.hasNext(); )
+        for ( int j = 0; j < deps.length; j++ )
         {
-            Artifact artifact = (Artifact) it.next();
-            if ( artifact.getArtifactHandler().isAddedToClasspath() )
+            IdeDependency dep = deps[j];
+
+            if ( dep.isAddedToClasspath() )
             {
-                addDependency( writer, artifact, referencedReactorArtifacts, localRepository, artifactResolver,
-                               artifactFactory, projectBaseDir );
+                addDependency( writer, dep, localRepository, projectBaseDir );
             }
         }
 
@@ -189,9 +179,8 @@
 
     }
 
-    private void addDependency( XMLWriter writer, Artifact artifact, List referencedReactorArtifacts,
-                               ArtifactRepository localRepository, ArtifactResolver artifactResolver,
-                               ArtifactFactory artifactFactory, File projectBaseDir )
+    private void addDependency( XMLWriter writer, IdeDependency dep, ArtifactRepository localRepository,
+                                File projectBaseDir )
         throws MojoExecutionException
     {
 
@@ -200,29 +189,29 @@
         String sourcepath = null;
         String javadocpath = null;
 
-        if ( referencedReactorArtifacts.contains( artifact ) )
+        if ( dep.isReferencedProject() )
         {
-            path = "/" + artifact.getArtifactId(); //$NON-NLS-1$
+            path = "/" + dep.getArtifactId(); //$NON-NLS-1$
             kind = "src"; //$NON-NLS-1$
         }
         else
         {
-            File artifactPath = artifact.getFile();
+            File artifactPath = dep.getFile();
 
             if ( artifactPath == null )
             {
-                getLog().error( Messages.getString( "EclipsePlugin.artifactpathisnull", artifact.getId() ) ); //$NON-NLS-1$
+                getLog().error( Messages.getString( "EclipsePlugin.artifactpathisnull", dep.getId() ) ); //$NON-NLS-1$
                 return;
             }
 
-            if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+            if ( dep.isSystemScoped() )
             {
-                path = EclipseUtils.toRelativeAndFixSeparator( projectBaseDir, artifactPath, false );
+                path = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, artifactPath, false );
 
                 if ( getLog().isDebugEnabled() )
                 {
                     getLog().debug( Messages.getString( "EclipsePlugin.artifactissystemscoped", //$NON-NLS-1$
-                                                        new Object[] { artifact.getArtifactId(), path } ) );
+                                                        new Object[] { dep.getArtifactId(), path } ) );
                 }
 
                 kind = "lib"; //$NON-NLS-1$
@@ -234,37 +223,20 @@
                 String fullPath = artifactPath.getPath();
 
                 path = "M2_REPO/" //$NON-NLS-1$
-                    + EclipseUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
+                    + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
 
-                Artifact sourceArtifact = EclipseUtils.resolveLocalSourceArtifact( artifact, localRepository,
-                                                                                   artifactResolver, artifactFactory );
-
-                if ( sourceArtifact.isResolved() )
+                if ( dep.getSourceAttachment() != null )
                 {
                     sourcepath = "M2_REPO/" //$NON-NLS-1$
-                        + EclipseUtils.toRelativeAndFixSeparator( localRepositoryFile, sourceArtifact.getFile(), false );
+                        + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, dep.getSourceAttachment(), false );
                 }
-                else
-                {
 
-                    // if a source artifact is not available, try with a plain javadoc jar
-                    Artifact javadocArtifact = EclipseUtils.resolveLocalJavadocArtifact( artifact, localRepository,
-                                                                                         artifactResolver,
-                                                                                         artifactFactory );
-                    if ( javadocArtifact.isResolved() )
-                    {
-                        try
-                        {
-                            // NB eclipse (3.1) doesn't support variables in javadoc paths, so we need to add the
-                            // full path for the maven repo
-                            javadocpath = StringUtils.replace( javadocArtifact.getFile().getCanonicalPath(), "\\", "/" ); //$NON-NLS-1$ //$NON-NLS-2$
-                        }
-                        catch ( IOException e )
-                        {
-                            // should never happen
-                            throw new MojoExecutionException( e.getMessage(), e );
-                        }
-                    }
+                if ( dep.getJavadocAttachment() != null )
+                {
+                    //                  NB eclipse (3.1) doesn't support variables in javadoc paths, so we need to add the
+                    // full path for the maven repo
+                    javadocpath = StringUtils.replace( IdeUtils.getCanonicalPath( dep.getJavadocAttachment() ),
+                                                       "\\", "/" ); //$NON-NLS-1$ //$NON-NLS-2$
                 }
 
                 kind = "var"; //$NON-NLS-1$

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java Sat Apr  1 07:39:33 2006
@@ -25,11 +25,11 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
@@ -63,13 +63,13 @@
 
     private static final String FILE_DOT_PROJECT = ".project"; //$NON-NLS-1$
 
-    public EclipseProjectWriter( Log log, File eclipseProjectDir, MavenProject project )
+    public EclipseProjectWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project );
+        super( log, eclipseProjectDir, project, deps );
     }
 
-    public void write( File projectBaseDir, MavenProject executedProject, List reactorArtifacts,
-                      List addedProjectnatures, List addedBuildCommands )
+    public void write( File projectBaseDir, MavenProject executedProject, List addedProjectnatures,
+                       List addedBuildCommands )
         throws MojoExecutionException
     {
 
@@ -159,8 +159,7 @@
         writer.endElement();
 
         // TODO: this entire element might be dropped if the comment is null.
-        // but as the maven1 eclipse plugin does it, it's better to be safe than
-        // sorry
+        // but as the maven1 eclipse plugin does it, it's better to be safe than sorry
         // A eclipse developer might want to look at this.
         writer.startElement( "comment" ); //$NON-NLS-1$
 
@@ -173,12 +172,13 @@
 
         writer.startElement( "projects" ); //$NON-NLS-1$
 
-        if ( reactorArtifacts != null && !reactorArtifacts.isEmpty() )
+        for ( int j = 0; j < deps.length; j++ )
         {
-            for ( Iterator it = reactorArtifacts.iterator(); it.hasNext(); )
+            IdeDependency dep = deps[j];
+            if ( dep.isReferencedProject() )
             {
                 writer.startElement( "project" ); //$NON-NLS-1$
-                writer.writeText( ( (Artifact) it.next() ).getArtifactId() );
+                writer.writeText( dep.getArtifactId() );
                 writer.endElement();
             }
         }
@@ -243,7 +243,7 @@
             writer.startElement( "link" ); //$NON-NLS-1$
 
             writer.startElement( ELT_NAME );
-            writer.writeText( EclipseUtils.toRelativeAndFixSeparator( projectBaseDir, file, true ) );
+            writer.writeText( IdeUtils.toRelativeAndFixSeparator( projectBaseDir, file, true ) );
             writer.endElement(); // name
 
             writer.startElement( "type" ); //$NON-NLS-1$
@@ -251,15 +251,9 @@
             writer.endElement(); // type
 
             writer.startElement( "location" ); //$NON-NLS-1$
-            try
-            {
-                writer.writeText( file.getCanonicalPath().replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcanonicalize", file //$NON-NLS-1$
-                    .getAbsolutePath() ), e );
-            }
+
+            writer.writeText( IdeUtils.getCanonicalPath( file ).replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+
             writer.endElement(); // location
 
             writer.endElement(); // link
@@ -283,7 +277,7 @@
                 writer.startElement( "link" ); //$NON-NLS-1$
 
                 writer.startElement( ELT_NAME );
-                writer.writeText( EclipseUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRoot, true ) );
+                writer.writeText( IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRoot, true ) );
                 writer.endElement(); // name
 
                 writer.startElement( "type" ); //$NON-NLS-1$
@@ -291,15 +285,8 @@
                 writer.endElement(); // type
 
                 writer.startElement( "location" ); //$NON-NLS-1$
-                try
-                {
-                    writer.writeText( sourceRoot.getCanonicalPath().replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                }
-                catch ( IOException e )
-                {
-                    throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcanonicalize", sourceRoot //$NON-NLS-1$
-                        .getAbsolutePath() ), e );
-                }
+
+                writer.writeText( IdeUtils.getCanonicalPath( sourceRoot ).replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
 
                 writer.endElement(); // location
 
@@ -321,7 +308,7 @@
                 writer.startElement( "link" ); //$NON-NLS-1$
 
                 writer.startElement( ELT_NAME );
-                writer.writeText( EclipseUtils.toRelativeAndFixSeparator( projectBaseDir, resourceDir, true ) );
+                writer.writeText( IdeUtils.toRelativeAndFixSeparator( projectBaseDir, resourceDir, true ) );
                 writer.endElement(); // name
 
                 writer.startElement( "type" ); //$NON-NLS-1$
@@ -329,15 +316,9 @@
                 writer.endElement(); // type
 
                 writer.startElement( "location" ); //$NON-NLS-1$
-                try
-                {
-                    writer.writeText( resourceDir.getCanonicalPath().replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                }
-                catch ( IOException e )
-                {
-                    throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcanonicalize", resourceDir //$NON-NLS-1$
-                        .getAbsolutePath() ), e );
-                }
+
+                writer.writeText( IdeUtils.getCanonicalPath( resourceDir ).replaceAll( "\\\\", "/" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+
                 writer.endElement(); // location
 
                 writer.endElement(); // link

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseSettingsWriter.java Sat Apr  1 07:39:33 2006
@@ -24,8 +24,9 @@
 import java.util.Properties;
 
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 
@@ -63,9 +64,9 @@
 
     private static final String ARTIFACT_MAVEN_COMPILER_PLUGIN = "maven-compiler-plugin"; //$NON-NLS-1$
 
-    public EclipseSettingsWriter( Log log, File eclipseProjectDir, MavenProject project )
+    public EclipseSettingsWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project );
+        super( log, eclipseProjectDir, project, deps );
     }
 
     public void write()
@@ -75,10 +76,8 @@
         // check if it's necessary to create project specific settings
         Properties coreSettings = new Properties();
 
-        String source = EclipseUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_COMPILER_PLUGIN, PROPERTY_SOURCE,
-                                                       null );
-        String target = EclipseUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_COMPILER_PLUGIN, PROPERTY_TARGET,
-                                                       null );
+        String source = IdeUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_COMPILER_PLUGIN, PROPERTY_SOURCE, null );
+        String target = IdeUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_COMPILER_PLUGIN, PROPERTY_TARGET, null );
 
         if ( source != null )
         {

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponentWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponentWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponentWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponentWriter.java Sat Apr  1 07:39:33 2006
@@ -19,14 +19,13 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
@@ -56,13 +55,12 @@
      */
     private static final String FILE_DOT_COMPONENT = ".component"; //$NON-NLS-1$
 
-    public EclipseWtpComponentWriter( Log log, File eclipseProjectDir, MavenProject project, Collection artifacts )
+    public EclipseWtpComponentWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project, artifacts );
+        super( log, eclipseProjectDir, project, deps );
     }
 
-    public void write( List referencedReactorArtifacts, EclipseSourceDir[] sourceDirs,
-                       ArtifactRepository localRepository, File buildOutputDirectory )
+    public void write( EclipseSourceDir[] sourceDirs, ArtifactRepository localRepository, File buildOutputDirectory )
         throws MojoExecutionException
     {
 
@@ -83,8 +81,7 @@
         // create a .component file and write out to it
         XMLWriter writer = new PrettyPrintXMLWriter( w );
         String packaging = getProject().getPackaging();
-        writeModuleTypeComponent( writer, packaging, buildOutputDirectory, sourceDirs, referencedReactorArtifacts,
-                                  localRepository );
+        writeModuleTypeComponent( writer, packaging, buildOutputDirectory, sourceDirs, localRepository );
         IOUtil.close( w );
 
     }
@@ -100,8 +97,7 @@
      * @throws MojoExecutionException
      */
     private void writeModuleTypeComponent( XMLWriter writer, String packaging, File buildOutputDirectory,
-                                           EclipseSourceDir[] sourceDirs, List referencedReactorArtifacts,
-                                           ArtifactRepository localRepository )
+                                           EclipseSourceDir[] sourceDirs, ArtifactRepository localRepository )
         throws MojoExecutionException
     {
         writer.startElement( ELT_PROJECT_MODULES );
@@ -117,9 +113,9 @@
         {
             target = "/WEB-INF/classes"; //$NON-NLS-1$
 
-            String warSourceDirectory = EclipseUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
-                                                                       "warSourceDirectory", //$NON-NLS-1$
-                                                                       "/src/main/webapp" ); //$NON-NLS-1$
+            String warSourceDirectory = IdeUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
+                                                                   "warSourceDirectory", //$NON-NLS-1$
+                                                                   "/src/main/webapp" ); //$NON-NLS-1$
 
             writer.startElement( ELT_PROPERTY );
             writer.addAttribute( ATTR_CONTEXT_ROOT, getProject().getArtifactId() );
@@ -127,7 +123,7 @@
 
             writer.startElement( ELT_WB_RESOURCE );
             writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$
-            writer.addAttribute( ATTR_SOURCE_PATH, EclipseUtils
+            writer.addAttribute( ATTR_SOURCE_PATH, IdeUtils
                 .toRelativeAndFixSeparator( getProject().getBasedir(), new File( getEclipseProjectDirectory(),
                                                                                  warSourceDirectory ), false ) );
             writer.endElement();
@@ -136,7 +132,7 @@
             writer.startElement( ELT_PROPERTY );
             writer.addAttribute( ATTR_NAME, "java-output-path" ); //$NON-NLS-1$
             writer.addAttribute( ATTR_VALUE, "/" //$NON-NLS-1$
-                + EclipseUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
+                + IdeUtils.toRelativeAndFixSeparator( getProject().getBasedir(), buildOutputDirectory, false ) );
             writer.endElement(); // property
 
         }
@@ -151,7 +147,7 @@
         if ( "war".equalsIgnoreCase( packaging ) || "ear".equalsIgnoreCase( packaging ) ) //$NON-NLS-1$ //$NON-NLS-2$
         {
             // write out the dependencies.
-            writeWarOrEarResources( writer, getProject(), referencedReactorArtifacts, localRepository );
+            writeWarOrEarResources( writer, getProject(), localRepository );
 
         }
 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpFacetsWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpFacetsWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpFacetsWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpFacetsWriter.java Sat Apr  1 07:39:33 2006
@@ -19,13 +19,12 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
@@ -73,13 +72,12 @@
      */
     private static final String FILE_FACET_CORE_XML = "org.eclipse.wst.common.project.facet.core.xml"; //$NON-NLS-1$
 
-    public EclipseWtpFacetsWriter( Log log, File eclipseProjectDir, MavenProject project, Collection artifacts )
+    public EclipseWtpFacetsWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project, artifacts );
+        super( log, eclipseProjectDir, project, deps );
     }
 
-    public void write( List referencedReactorArtifacts, EclipseSourceDir[] sourceDirs,
-                      ArtifactRepository localRepository, File buildOutputDirectory )
+    public void write( EclipseSourceDir[] sourceDirs, ArtifactRepository localRepository, File buildOutputDirectory )
         throws MojoExecutionException
     {
 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpmodulesWriter.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpmodulesWriter.java?rev=390686&r1=390685&r2=390686&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpmodulesWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpmodulesWriter.java Sat Apr  1 07:39:33 2006
@@ -19,14 +19,13 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
-import org.apache.maven.plugin.eclipse.EclipseUtils;
 import org.apache.maven.plugin.eclipse.Messages;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.IOUtil;
@@ -45,13 +44,12 @@
 
     protected static final String FILE_DOT_WTPMODULES = ".wtpmodules"; //$NON-NLS-1$
 
-    public EclipseWtpmodulesWriter( Log log, File eclipseProjectDir, MavenProject project, Collection artifacts )
+    public EclipseWtpmodulesWriter( Log log, File eclipseProjectDir, MavenProject project, IdeDependency[] deps )
     {
-        super( log, eclipseProjectDir, project, artifacts );
+        super( log, eclipseProjectDir, project, deps );
     }
 
-    public void write( List referencedReactorArtifacts, EclipseSourceDir[] sourceDirs,
-                      ArtifactRepository localRepository, File buildOutputDirectory )
+    public void write( EclipseSourceDir[] sourceDirs, ArtifactRepository localRepository, File buildOutputDirectory )
         throws MojoExecutionException
     {
         FileWriter w;
@@ -84,19 +82,19 @@
         String target = "/"; //$NON-NLS-1$
         if ( "war".equals( getProject().getPackaging() ) ) //$NON-NLS-1$
         {
-            String warSourceDirectory = EclipseUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
-                                                                       "warSourceDirectory", //$NON-NLS-1$
-                                                                       "/src/main/webapp" ); //$NON-NLS-1$
+            String warSourceDirectory = IdeUtils.getPluginSetting( getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
+                                                                   "warSourceDirectory", //$NON-NLS-1$
+                                                                   "/src/main/webapp" ); //$NON-NLS-1$
 
             writer.startElement( ELT_WB_RESOURCE );
             writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$ 
             writer.addAttribute( ATTR_SOURCE_PATH, "/" //$NON-NLS-1$
-                + EclipseUtils.toRelativeAndFixSeparator( getEclipseProjectDirectory(),
-                                                          new File( getEclipseProjectDirectory(), warSourceDirectory ),
-                                                          false ) );
+                + IdeUtils.toRelativeAndFixSeparator( getEclipseProjectDirectory(),
+                                                      new File( getEclipseProjectDirectory(), warSourceDirectory ),
+                                                      false ) );
             writer.endElement();
 
-            writeWarOrEarResources( writer, getProject(), referencedReactorArtifacts, localRepository );
+            writeWarOrEarResources( writer, getProject(), localRepository );
 
             target = "/WEB-INF/classes"; //$NON-NLS-1$
         }
@@ -107,7 +105,7 @@
             writer.addAttribute( ATTR_SOURCE_PATH, "/" ); //$NON-NLS-1$ 
             writer.endElement();
 
-            writeWarOrEarResources( writer, getProject(), referencedReactorArtifacts, localRepository );
+            writeWarOrEarResources( writer, getProject(), localRepository );
         }
 
         for ( int j = 0; j < sourceDirs.length; j++ )