You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2007/11/02 03:17:02 UTC

svn commit: r591192 [3/4] - in /maven/plugins/branches/MECLIPSE-333/src: main/java/org/apache/maven/plugin/eclipse/ main/java/org/apache/maven/plugin/eclipse/writers/ main/java/org/apache/maven/plugin/eclipse/writers/rad/ main/java/org/apache/maven/plu...

Modified: maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java Thu Nov  1 19:16:57 2007
@@ -18,23 +18,25 @@
  */
 package org.apache.maven.plugin.eclipse.writers.wtp;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.eclipse.Constants;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
 import org.apache.maven.plugin.eclipse.Messages;
 import org.apache.maven.plugin.ide.IdeUtils;
+import org.apache.maven.plugin.ide.JeeUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
 /**
  * Writes eclipse .wtpmodules file.
- *
+ * 
  * @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
  * @version $Id$
  */
@@ -54,7 +56,9 @@
 
         try
         {
-            w = new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(), FILE_DOT_WTPMODULES ) ), "UTF-8" );
+            w =
+                new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(),
+                                                                        FILE_DOT_WTPMODULES ) ), "UTF-8" );
         }
         catch ( IOException ex )
         {
@@ -77,23 +81,26 @@
         // deploy-path is "/" for utility and ejb projects, "/WEB-INF/classes" for webapps
 
         String target = "/"; //$NON-NLS-1$
-        if ( "war".equals( config.getPackaging() ) ) //$NON-NLS-1$
+        if ( Constants.PROJECT_PACKAGING_WAR.equals( config.getPackaging() ) ) //$NON-NLS-1$
         {
-            String warSourceDirectory = IdeUtils.getPluginSetting( config.getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
-                                                                   "warSourceDirectory", //$NON-NLS-1$
-                                                                   config.getProject().getBasedir()+"/src/main/webapp" ); //$NON-NLS-1$
+            String warSourceDirectory =
+                IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
+                                           "warSourceDirectory", //$NON-NLS-1$
+                                           config.getProject().getBasedir() + "/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$
-                + IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), new File( warSourceDirectory ), false ) );
+                +
+                IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(),
+                                                    new File( warSourceDirectory ), false ) );
             writer.endElement();
 
             writeWarOrEarResources( writer, config.getProject(), config.getLocalRepository() );
 
             target = "/WEB-INF/classes"; //$NON-NLS-1$
         }
-        else if ( "ear".equals( config.getPackaging() ) ) //$NON-NLS-1$
+        else if ( Constants.PROJECT_PACKAGING_EAR.equals( config.getPackaging() ) ) //$NON-NLS-1$
         {
             writer.startElement( ELT_WB_RESOURCE );
             writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$

Modified: maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java Thu Nov  1 19:16:57 2007
@@ -60,16 +60,16 @@
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.eclipse.Constants;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.IOUtil;
 
 /**
- * Abstract base plugin which takes care of the common stuff usually needed by maven IDE plugins. A
- * plugin extending AbstractIdeSupportMojo should implement the <code>setup()</code> and
- * <code>writeConfiguration()</code> methods, plus the getters needed to get the various
- * configuration flags and required components. The lifecycle:
+ * Abstract base plugin which takes care of the common stuff usually needed by maven IDE plugins. A plugin extending
+ * AbstractIdeSupportMojo should implement the <code>setup()</code> and <code>writeConfiguration()</code> methods,
+ * plus the getters needed to get the various configuration flags and required components. The lifecycle:
  * 
  * <pre>
  *       *** calls setup() where you can configure your specific stuff and stop the mojo from execute if appropriate ***
@@ -111,7 +111,7 @@
      * @parameter expression="${project.packaging}"
      */
     protected String packaging;
-    
+
     /**
      * Artifact factory, needed to download source jars for inclusion in classpath.
      * 
@@ -163,8 +163,7 @@
     protected ArtifactRepository localRepository;
 
     /**
-     * If the executed project is a reactor project, this will contains the full list of projects in
-     * the reactor.
+     * If the executed project is a reactor project, this will contains the full list of projects in the reactor.
      * 
      * @parameter expression="${reactorProjects}"
      * @required
@@ -178,26 +177,22 @@
      * @parameter expression="${eclipse.skip}" default-value="false"
      */
     private boolean skip;
-    
+
     /**
      * Enables/disables the downloading of source attachments. Defaults to false. When this flag is <code>true</code>
-     * remote repositories are checked for sources: in order to avoid repeated check for unavailable source archives,
-     * a status cache is mantained into the target dir of the root project. Run <code>mvn:clean</code> or delete the
+     * remote repositories are checked for sources: in order to avoid repeated check for unavailable source archives, a
+     * status cache is mantained into the target dir of the root project. Run <code>mvn:clean</code> or delete the
      * file <code>mvn-eclipse-cache.properties</code> in order to reset this cache.
+     * 
      * @parameter expression="${downloadSources}"
      */
     protected boolean downloadSources;
 
     /**
-     * Enables/disables the downloading of javadoc
-     * attachments. Defaults to false. When this flag is
-     * <code>true</code> remote repositories are checked
-     * for javadocs: in order to avoid repeated check for
-     * unavailable javadoc archives, a status cache is
-     * mantained into the target dir of the root project.
-     * Run <code>mvn:clean</code> or delete the file
-     * <code>mvn-eclipse-cache.properties</code> in order
-     * to reset this cache.
+     * Enables/disables the downloading of javadoc attachments. Defaults to false. When this flag is <code>true</code>
+     * remote repositories are checked for javadocs: in order to avoid repeated check for unavailable javadoc archives,
+     * a status cache is mantained into the target dir of the root project. Run <code>mvn:clean</code> or delete the
+     * file <code>mvn-eclipse-cache.properties</code> in order to reset this cache.
      * 
      * @parameter expression="${downloadJavadocs}"
      */
@@ -210,6 +205,7 @@
 
     /**
      * Getter for <code>artifactMetadataSource</code>.
+     * 
      * @return Returns the artifactMetadataSource.
      */
     public ArtifactMetadataSource getArtifactMetadataSource()
@@ -219,6 +215,7 @@
 
     /**
      * Setter for <code>artifactMetadataSource</code>.
+     * 
      * @param artifactMetadataSource The artifactMetadataSource to set.
      */
     public void setArtifactMetadataSource( ArtifactMetadataSource artifactMetadataSource )
@@ -228,6 +225,7 @@
 
     /**
      * Getter for <code>project</code>.
+     * 
      * @return Returns the project.
      */
     public MavenProject getProject()
@@ -237,6 +235,7 @@
 
     /**
      * Setter for <code>project</code>.
+     * 
      * @param project The project to set.
      */
     public void setProject( MavenProject project )
@@ -246,6 +245,7 @@
 
     /**
      * Getter for <code>reactorProjects</code>.
+     * 
      * @return Returns the reactorProjects.
      */
     public List getReactorProjects()
@@ -255,6 +255,7 @@
 
     /**
      * Setter for <code>reactorProjects</code>.
+     * 
      * @param reactorProjects The reactorProjects to set.
      */
     public void setReactorProjects( List reactorProjects )
@@ -264,6 +265,7 @@
 
     /**
      * Getter for <code>remoteArtifactRepositories</code>.
+     * 
      * @return Returns the remoteArtifactRepositories.
      */
     public List getRemoteArtifactRepositories()
@@ -273,6 +275,7 @@
 
     /**
      * Setter for <code>remoteArtifactRepositories</code>.
+     * 
      * @param remoteArtifactRepositories The remoteArtifactRepositories to set.
      */
     public void setRemoteArtifactRepositories( List remoteArtifactRepositories )
@@ -282,6 +285,7 @@
 
     /**
      * Getter for <code>artifactFactory</code>.
+     * 
      * @return Returns the artifactFactory.
      */
     public ArtifactFactory getArtifactFactory()
@@ -291,6 +295,7 @@
 
     /**
      * Setter for <code>artifactFactory</code>.
+     * 
      * @param artifactFactory The artifactFactory to set.
      */
     public void setArtifactFactory( ArtifactFactory artifactFactory )
@@ -300,6 +305,7 @@
 
     /**
      * Getter for <code>artifactResolver</code>.
+     * 
      * @return Returns the artifactResolver.
      */
     public ArtifactResolver getArtifactResolver()
@@ -309,6 +315,7 @@
 
     /**
      * Setter for <code>artifactResolver</code>.
+     * 
      * @param artifactResolver The artifactResolver to set.
      */
     public void setArtifactResolver( ArtifactResolver artifactResolver )
@@ -318,6 +325,7 @@
 
     /**
      * Getter for <code>executedProject</code>.
+     * 
      * @return Returns the executedProject.
      */
     public MavenProject getExecutedProject()
@@ -327,6 +335,7 @@
 
     /**
      * Setter for <code>executedProject</code>.
+     * 
      * @param executedProject The executedProject to set.
      */
     public void setExecutedProject( MavenProject executedProject )
@@ -336,6 +345,7 @@
 
     /**
      * Getter for <code>localRepository</code>.
+     * 
      * @return Returns the localRepository.
      */
     public ArtifactRepository getLocalRepository()
@@ -345,6 +355,7 @@
 
     /**
      * Setter for <code>localRepository</code>.
+     * 
      * @param localRepository The localRepository to set.
      */
     public void setLocalRepository( ArtifactRepository localRepository )
@@ -371,7 +382,7 @@
     {
         this.downloadJavadocs = downloadJavadoc;
     }
-    
+
     /**
      * Getter for <code>downloadSources</code>.
      * 
@@ -384,18 +395,19 @@
 
     /**
      * Setter for <code>downloadSources</code>.
+     * 
      * @param downloadSources The downloadSources to set.
      */
     public void setDownloadSources( boolean downloadSources )
     {
         this.downloadSources = downloadSources;
     }
-    
+
     protected void setResolveDependencies( boolean resolveDependencies )
     {
         this.resolveDependencies = resolveDependencies;
     }
-    
+
     protected boolean isResolveDependencies()
     {
         return resolveDependencies;
@@ -404,12 +416,14 @@
     /**
      * return <code>false</code> if projects available in a reactor build should be considered normal dependencies,
      * <code>true</code> if referenced project will be linked and not need artifact resolution.
+     * 
      * @return <code>true</code> if referenced project will be linked and not need artifact resolution
      */
     protected abstract boolean getUseProjectReferences();
 
     /**
      * Hook for preparation steps before the actual plugin execution.
+     * 
      * @return <code>true</code> if execution should continue or <code>false</code> if not.
      * @throws MojoExecutionException generic mojo exception
      */
@@ -418,7 +432,8 @@
 
     /**
      * Main plugin method where dependencies should be processed in order to generate IDE configuration files.
-     * @param deps list of  <code>IdeDependency</code> objects, with artifacts, sources and javadocs already resolved
+     * 
+     * @param deps list of <code>IdeDependency</code> objects, with artifacts, sources and javadocs already resolved
      * @throws MojoExecutionException generic mojo exception
      */
     protected abstract void writeConfiguration( IdeDependency[] deps )
@@ -432,17 +447,17 @@
     /**
      * Not a plugin parameter. Collect the list of dependencies with a missing javadoc artifact for the final report.
      */
-     // TODO merge this with the missingSourceDependencies in a classifier based map?
-     private List missingJavadocDependencies = new ArrayList();
-    
+    // TODO merge this with the missingSourceDependencies in a classifier based map?
+    private List missingJavadocDependencies = new ArrayList();
+
     /**
      * Cached array of resolved dependencies.
      */
     private IdeDependency[] ideDeps;
-    
+
     /**
-     * Flag for mojo implementations to control whether normal maven dependencies should be resolved.
-     * Default value is true.
+     * Flag for mojo implementations to control whether normal maven dependencies should be resolved. Default value is
+     * true.
      */
     private boolean resolveDependencies = true;
 
@@ -460,10 +475,10 @@
     public final void execute()
         throws MojoExecutionException, MojoFailureException
     {
-    	if ( skip )
-    	{
-    		return;
-    	}
+        if ( skip )
+        {
+            return;
+        }
 
         boolean processProject = setup();
         if ( !processProject )
@@ -486,6 +501,7 @@
      * Resolve project dependencies. Manual resolution is needed in order to avoid resoltion of multiproject artifacts
      * (if projects will be linked each other an installed jar is not needed) and to avoid a failure when a jar is
      * missing.
+     * 
      * @throws MojoExecutionException if dependencies can't be resolved
      * @return resoved IDE dependencies, with attached jars for non-reactor dependencies
      */
@@ -506,8 +522,9 @@
 
                 if ( deps != null )
                 {
-                    Map managedVersions = createManagedVersionMap( getArtifactFactory(), project.getId(), project
-                        .getDependencyManagement() );
+                    Map managedVersions =
+                        createManagedVersionMap( getArtifactFactory(), project.getId(),
+                                                 project.getDependencyManagement() );
 
                     ArtifactResolutionResult artifactResolutionResult = null;
 
@@ -523,24 +540,23 @@
 
                         listeners.add( new WarningResolutionListener( logger ) );
 
-                        artifactResolutionResult = artifactCollector.collect( getProjectArtifacts(), project
-                            .getArtifact(), managedVersions, localRepo, project.getRemoteArtifactRepositories(),
-                                                                              getArtifactMetadataSource(), null,
-                                                                              listeners );
+                        artifactResolutionResult =
+                            artifactCollector.collect( getProjectArtifacts(), project.getArtifact(), managedVersions,
+                                                       localRepo, project.getRemoteArtifactRepositories(),
+                                                       getArtifactMetadataSource(), null, listeners );
                     }
                     catch ( ArtifactResolutionException e )
                     {
                         getLog().debug( e.getMessage(), e );
                         getLog().error(
                                         Messages.getString( "artifactresolution", new Object[] { //$NON-NLS-1$
-                                                                e.getGroupId(),
-                                                                e.getArtifactId(),
-                                                                e.getVersion(),
+                                                            e.getGroupId(), e.getArtifactId(), e.getVersion(),
                                                                 e.getMessage() } ) );
 
-                        // if we are here artifactResolutionResult is null, create a project without dependencies but don't fail
+                        // if we are here artifactResolutionResult is null, create a project without dependencies but
+                        // don't fail
                         // (this could be a reactor projects, we don't want to fail everything)
-                        //  Causes MECLIPSE-185. Not sure if it should be handled this way??
+                        // Causes MECLIPSE-185. Not sure if it should be handled this way??
                         return new IdeDependency[0];
                     }
 
@@ -567,9 +583,7 @@
                                 getLog().debug( e.getMessage(), e );
                                 getLog().warn(
                                                Messages.getString( "artifactdownload", new Object[] { //$NON-NLS-1$
-                                                                       e.getGroupId(),
-                                                                       e.getArtifactId(),
-                                                                       e.getVersion(),
+                                                                   e.getGroupId(), e.getArtifactId(), e.getVersion(),
                                                                        e.getMessage() } ) );
                             }
                             catch ( ArtifactResolutionException e )
@@ -577,26 +591,27 @@
                                 getLog().debug( e.getMessage(), e );
                                 getLog().warn(
                                                Messages.getString( "artifactresolution", new Object[] { //$NON-NLS-1$
-                                                                       e.getGroupId(),
-                                                                       e.getArtifactId(),
-                                                                       e.getVersion(),
+                                                                   e.getGroupId(), e.getArtifactId(), e.getVersion(),
                                                                        e.getMessage() } ) );
                             }
                         }
 
-                        if ( !isReactorProject
-                            || emittedReactorProjectId.add( art.getGroupId() + '-' + art.getArtifactId() ) )
+                        if ( !isReactorProject ||
+                            emittedReactorProjectId.add( art.getGroupId() + '-' + art.getArtifactId() ) )
                         {
 
-                            // the following doesn't work: art.getArtifactHandler().getPackaging() always returns "jar" also
+                            // the following doesn't work: art.getArtifactHandler().getPackaging() always returns "jar"
+                            // also
                             // if the packaging specified in pom.xml is different.
 
                             // osgi-bundle packaging is provided by the felix osgi plugin
                             // eclipse-plugin packaging is provided by this eclipse plugin
                             // String packaging = art.getArtifactHandler().getPackaging();
-                            // boolean isOsgiBundle = "osgi-bundle".equals( packaging ) || "eclipse-plugin".equals( packaging );
+                            // boolean isOsgiBundle = "osgi-bundle".equals( packaging ) || "eclipse-plugin".equals(
+                            // packaging );
 
-                            // we need to check the manifest, if "Bundle-SymbolicName" is there the artifact can be considered
+                            // we need to check the manifest, if "Bundle-SymbolicName" is there the artifact can be
+                            // considered
                             // an osgi bundle
                             boolean isOsgiBundle = false;
                             String osgiSymbolicName = null;
@@ -610,8 +625,10 @@
                                     Manifest manifest = jarFile.getManifest();
                                     if ( manifest != null )
                                     {
-                                        osgiSymbolicName = manifest.getMainAttributes()
-                                            .getValue( new Attributes.Name( "Bundle-SymbolicName" ) );
+                                        osgiSymbolicName =
+                                            manifest.getMainAttributes().getValue(
+                                                                                   new Attributes.Name(
+                                                                                                        "Bundle-SymbolicName" ) );
                                     }
                                 }
                                 catch ( IOException e )
@@ -636,14 +653,17 @@
 
                             isOsgiBundle = osgiSymbolicName != null;
 
-                            IdeDependency dep = new IdeDependency( art.getGroupId(), art.getArtifactId(), art
-                                .getVersion(), art.getClassifier(), isReactorProject, Artifact.SCOPE_TEST.equals( art
-                                .getScope() ), Artifact.SCOPE_SYSTEM.equals( art.getScope() ), Artifact.SCOPE_PROVIDED
-                                .equals( art.getScope() ), art.getArtifactHandler().isAddedToClasspath(),
-                                art.getFile(), art.getType(), isOsgiBundle, osgiSymbolicName, dependencyDepth,
-                                getProjectNameForArifact(art));
-                            //no duplicate entries allowed. System paths can cause this problem.
-                            if ( !dependencies.contains(dep) )
+                            IdeDependency dep =
+                                new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
+                                                   art.getClassifier(), isReactorProject,
+                                                   Artifact.SCOPE_TEST.equals( art.getScope() ),
+                                                   Artifact.SCOPE_SYSTEM.equals( art.getScope() ),
+                                                   Artifact.SCOPE_PROVIDED.equals( art.getScope() ),
+                                                   art.getArtifactHandler().isAddedToClasspath(), art.getFile(),
+                                                   art.getType(), isOsgiBundle, osgiSymbolicName, dependencyDepth,
+                                                   getProjectNameForArifact( art ) );
+                            // no duplicate entries allowed. System paths can cause this problem.
+                            if ( !dependencies.contains( dep ) )
                             {
                                 dependencies.add( dep );
                             }
@@ -666,23 +686,21 @@
 
         return ideDeps;
     }
-    
+
     /**
      * Find the name of the project as used in eclipse.
+     * 
      * @param artifact The artifact to find the eclipse name for.
      * @return The name os the eclipse project.
      */
-    abstract public String getProjectNameForArifact(Artifact artifact) ;
-    
+    abstract public String getProjectNameForArifact( Artifact artifact );
+
     /**
-     * Returns the list of project artifacts. Also artifacts
-     * generated from referenced projects will be added, but
-     * with the <code>resolved</code> property set to
-     * true.
+     * Returns the list of project artifacts. Also artifacts generated from referenced projects will be added, but with
+     * the <code>resolved</code> property set to true.
      * 
      * @return list of projects artifacts
-     * @throws MojoExecutionException if unable to parse
-     *             dependency versions
+     * @throws MojoExecutionException if unable to parse dependency versions
      */
     private Set getProjectArtifacts()
         throws MojoExecutionException
@@ -703,17 +721,19 @@
             }
             catch ( InvalidVersionSpecificationException e )
             {
-                throw new MojoExecutionException( Messages.getString( "unabletoparseversion", new Object[] { //$NON-NLS-1$
-                                                                          dependency.getArtifactId(),
+                throw new MojoExecutionException(
+                                                  Messages.getString(
+                                                                      "unabletoparseversion", new Object[] { //$NON-NLS-1$
+                                                                      dependency.getArtifactId(),
                                                                           dependency.getVersion(),
-                                                                          dependency.getManagementKey(),
-                                                                          e.getMessage() } ), e );
+                                                                          dependency.getManagementKey(), e.getMessage() } ),
+                                                  e );
             }
 
             String type = dependency.getType();
             if ( type == null )
             {
-                type = "jar"; //$NON-NLS-1$
+                type = Constants.PROJECT_PACKAGING_JAR; //$NON-NLS-1$
             }
             String classifier = dependency.getClassifier();
             boolean optional = dependency.isOptional();
@@ -723,8 +743,9 @@
                 scope = Artifact.SCOPE_COMPILE;
             }
 
-            Artifact art = getArtifactFactory().createDependencyArtifact( groupId, artifactId, versionRange, type,
-                                                                          classifier, scope, optional );
+            Artifact art =
+                getArtifactFactory().createDependencyArtifact( groupId, artifactId, versionRange, type, classifier,
+                                                               scope, optional );
 
             if ( scope.equalsIgnoreCase( Artifact.SCOPE_SYSTEM ) )
             {
@@ -750,6 +771,7 @@
 
     /**
      * Utility method that locates a project producing the given artifact.
+     * 
      * @param artifact the artifact a project should produce.
      * @return <code>true</code> if the artifact is produced by a reactor projectart.
      */
@@ -761,8 +783,8 @@
             {
                 MavenProject reactorProject = (MavenProject) iter.next();
 
-                if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
-                    && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
+                if ( reactorProject.getGroupId().equals( artifact.getGroupId() ) &&
+                    reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
                 {
                     if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
                     {
@@ -770,12 +792,11 @@
                     }
                     else
                     {
-                        getLog()
-                            .info(
-                                   "Artifact "
-                                       + artifact.getId()
-                                       + " already available as a reactor project, but with different version. Expected: "
-                                       + artifact.getVersion() + ", found: " + reactorProject.getVersion() );
+                        getLog().info(
+                                       "Artifact " +
+                                           artifact.getId() +
+                                           " already available as a reactor project, but with different version. Expected: " +
+                                           artifact.getVersion() + ", found: " + reactorProject.getVersion() );
                     }
                 }
             }
@@ -798,19 +819,18 @@
                 try
                 {
                     VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
-                    Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
-                                                                                  versionRange, d.getType(), d
-                                                                                      .getClassifier(), d.getScope(), d
-                                                                                      .isOptional() );
+                    Artifact artifact =
+                        artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange,
+                                                                  d.getType(), d.getClassifier(), d.getScope(),
+                                                                  d.isOptional() );
                     map.put( d.getManagementKey(), artifact );
                 }
                 catch ( InvalidVersionSpecificationException e )
                 {
                     throw new MojoExecutionException( Messages.getString( "unabletoparseversion", new Object[] { //$NON-NLS-1$
-                                                                              projectId,
-                                                                              d.getVersion(),
-                                                                              d.getManagementKey(),
-                                                                              e.getMessage() } ), e );
+                                                                          projectId, d.getVersion(),
+                                                                              d.getManagementKey(), e.getMessage() } ),
+                                                      e );
                 }
             }
         }
@@ -824,6 +844,7 @@
     /**
      * Find the reactor target dir. executedProject doesn't have the multiproject root dir set, and the only way to
      * extract it is iterating on parent projects.
+     * 
      * @param prj current project
      * @return the parent target dir.
      */
@@ -841,9 +862,10 @@
 
     /**
      * Resolve source artifacts and download them if <code>downloadSources</code> is <code>true</code>. Source and
-     * javadocs artifacts will be attached to the <code>IdeDependency</code>
-     * Resolve source and javadoc artifacts. The resolved artifacts will be downloaded based on the
-     * <code>downloadSources</code> and <code>downloadJavadocs</code> attributes. Source and
+     * javadocs artifacts will be attached to the <code>IdeDependency</code> Resolve source and javadoc artifacts. The
+     * resolved artifacts will be downloaded based on the <code>downloadSources</code> and
+     * <code>downloadJavadocs</code> attributes. Source and
+     * 
      * @param deps resolved dependencies
      */
     private void resolveSourceAndJavadocArtifacts( IdeDependency[] deps )
@@ -880,12 +902,12 @@
 
         }
 
-        final List missingSources = resolveDependenciesWithClassifier( deps, "sources", getDownloadSources(),
-                                                                       unavailableArtifactsCache );
+        final List missingSources =
+            resolveDependenciesWithClassifier( deps, "sources", getDownloadSources(), unavailableArtifactsCache );
         missingSourceDependencies.addAll( missingSources );
 
-        final List missingJavadocs = resolveDependenciesWithClassifier( deps, "javadoc", getDownloadJavadocs(),
-                                                                        unavailableArtifactsCache );
+        final List missingJavadocs =
+            resolveDependenciesWithClassifier( deps, "javadoc", getDownloadJavadocs(), unavailableArtifactsCache );
         missingJavadocDependencies.addAll( missingJavadocs );
 
         FileOutputStream fos = null;
@@ -906,30 +928,21 @@
     }
 
     /**
-     * Resolve the required artifacts for each of the
-     * dependency. <code>sources</code> or
-     * <code>javadoc</code> artifacts (depending on the
-     * <code>classifier</code>) are attached to the
-     * dependency.
+     * Resolve the required artifacts for each of the dependency. <code>sources</code> or <code>javadoc</code>
+     * artifacts (depending on the <code>classifier</code>) are attached to the dependency.
      * 
      * @param deps resolved dependencies
-     * @param classifier the classifier we are looking for
-     *            (either <code>sources</code> or
-     *            <code>javadoc</code>)
-     * @param includeRemoteRepositories flag whether we
-     *            should search remote repositories for the
-     *            artifacts or not
-     * @param unavailableArtifactsCache cache of unavailable
-     *            artifacts
-     * @return the list of dependencies for which the
-     *         required artifact was not found
+     * @param classifier the classifier we are looking for (either <code>sources</code> or <code>javadoc</code>)
+     * @param includeRemoteRepositories flag whether we should search remote repositories for the artifacts or not
+     * @param unavailableArtifactsCache cache of unavailable artifacts
+     * @return the list of dependencies for which the required artifact was not found
      */
     private List resolveDependenciesWithClassifier( IdeDependency[] deps, String inClassifier,
                                                     boolean includeRemoteRepositories,
                                                     Properties unavailableArtifactsCache )
     {
         List missingClassifierDependencies = new ArrayList();
-                                                                                        
+
         // if downloadSources is off, just check
         // local repository for reporting missing source jars
         List remoteRepos = includeRemoteRepositories ? getRemoteArtifactRepositories() : Collections.EMPTY_LIST;
@@ -940,27 +953,31 @@
 
             if ( dependency.isReferencedProject() || dependency.isSystemScoped() )
             {
-                //artifact not needed
+                // artifact not needed
                 continue;
             }
-            
-            //MECLIPSE-151 - if the dependency is a test, get the correct classifier for it. (ignore for javadocs)
+
+            // MECLIPSE-151 - if the dependency is a test, get the correct classifier for it. (ignore for javadocs)
             String classifier = inClassifier;
-            if("sources".equals( classifier ) && "tests".equals(dependency.getClassifier()))
+            if ( "sources".equals( classifier ) && "tests".equals( dependency.getClassifier() ) )
             {
                 classifier = "test-sources";
             }
-            
-            if(getLog().isDebugEnabled())
+
+            if ( getLog().isDebugEnabled() )
             {
-                getLog().debug("Searching for sources for "+dependency.getId()+":"+dependency.getClassifier()+" at "+dependency.getId() + ":" + classifier);
+                getLog().debug(
+                                "Searching for sources for " + dependency.getId() + ":" + dependency.getClassifier() +
+                                    " at " + dependency.getId() + ":" + classifier );
             }
-      
+
             if ( !unavailableArtifactsCache.containsKey( dependency.getId() + ":" + classifier ) )
             {
-                Artifact artifact = IdeUtils.resolveArtifactWithClassifier( dependency.getGroupId(), dependency
-                    .getArtifactId(), dependency.getVersion(), classifier, localRepository, artifactResolver, //$NON-NLS-1$
-                                                                            artifactFactory, remoteRepos, getLog() );
+                Artifact artifact =
+                    IdeUtils.resolveArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
+                                                            dependency.getVersion(), classifier, localRepository,
+                                                            artifactResolver, //$NON-NLS-1$
+                                                            artifactFactory, remoteRepos, getLog() );
                 if ( artifact.isResolved() )
                 {
                     if ( "sources".equals( classifier ) )

Modified: maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java Thu Nov  1 19:16:57 2007
@@ -18,6 +18,12 @@
  */
 package org.apache.maven.plugin.ide;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+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;
@@ -33,11 +39,6 @@
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
@@ -80,7 +81,8 @@
      */
     private static final String PROPERTY_TARGET = "target"; //$NON-NLS-1$
 
-    public static String getCanonicalPath( File file ) throws MojoExecutionException
+    public static String getCanonicalPath( File file )
+        throws MojoExecutionException
     {
         try
         {
@@ -96,8 +98,7 @@
     /**
      * Returns a compiler plugin settings, considering also settings altered in plugin executions .
      * 
-     * @param project
-     *            maven project
+     * @param project maven project
      * @return option value (may be null)
      */
     public static String getCompilerPluginSetting( MavenProject project, String optionName )
@@ -116,8 +117,7 @@
      * Returns the source version configured for the compiler plugin. Returns the minimum version required to compile
      * both standard and test sources, if settings are different.
      * 
-     * @param project
-     *            maven project
+     * @param project maven project
      * @return java source version
      */
     public static String getCompilerSourceVersion( MavenProject project )
@@ -129,8 +129,7 @@
      * Returns the target version configured for the compiler plugin. Returns the minimum version required to compile
      * both standard and test sources, if settings are different.
      * 
-     * @param project
-     *            maven project
+     * @param project maven project
      * @return java target version
      */
     public static String getCompilerTargetVersion( MavenProject project )
@@ -141,12 +140,9 @@
     /**
      * Extracts the version of the first matching dependency in the given list.
      * 
-     * @param artifactIds
-     *            artifact names to compare against for extracting version
-     * @param dependencies
-     *            Collection of dependencies for our project
-     * @param len
-     *            expected length of the version sub-string
+     * @param artifactIds artifact names to compare against for extracting version
+     * @param dependencies Collection of dependencies for our project
+     * @param len expected length of the version sub-string
      * @return
      */
     public static String getDependencyVersion( String[] artifactIds, List dependencies, int len )
@@ -167,27 +163,80 @@
     }
 
     /**
+     * Search for a configuration setting of an other plugin for a configuration setting.
+     * 
      * @todo there should be a better way to do this
+     * @param project the current maven project to get the configuration from.
+     * @param pluginId the group id and artifact id of the plugin to search for
+     * @param optionName the option to get from the configuration
+     * @param defaultValue the default value if the configuration was not found
+     * @return the value of the option configured in the plugin configuration
      */
-    public static String getPluginSetting( MavenProject project, String artifactId, String optionName,
-                                           String defaultValue )
+    public static String getPluginSetting( MavenProject project, String pluginId, String optionName, String defaultValue )
     {
-        for ( Iterator it = project.getModel().getBuild().getPlugins().iterator(); it.hasNext(); )
+        Xpp3Dom dom = getPluginConfigurationDom( project, pluginId );
+        if ( dom != null && dom.getChild( optionName ) != null )
         {
-            Plugin plugin = (Plugin) it.next();
+            return dom.getChild( optionName ).getValue();
+        }
+        return defaultValue;
+    }
 
-            if ( plugin.getArtifactId().equals( artifactId ) )
-            {
-                Xpp3Dom o = (Xpp3Dom) plugin.getConfiguration();
+    /**
+     * Search for the configuration Xpp3 dom of an other plugin.
+     * 
+     * @todo there should be a better way to do this
+     * @param project the current maven project to get the configuration from.
+     * @param pluginId the group id and artifact id of the plugin to search for
+     * @return the value of the option configured in the plugin configuration
+     */
+    public static Xpp3Dom getPluginConfigurationDom( MavenProject project, String pluginId )
+    {
 
-                if ( o != null && o.getChild( optionName ) != null )
+        Plugin plugin = (org.apache.maven.model.Plugin) project.getBuild().getPluginsAsMap().get( pluginId );
+        if ( plugin != null )
+        {
+            return (Xpp3Dom) plugin.getConfiguration();
+        }
+        return null;
+    }
+
+    /**
+     * Search for the configuration Xpp3 dom of an other plugin.
+     * 
+     * @todo there should be a better way to do this
+     * @param project the current maven project to get the configuration from.
+     * @param artifactId the artifact id of the plugin to search for
+     * @return the value of the option configured in the plugin configuration
+     */
+    public static Xpp3Dom[] getPluginConfigurationDom( MavenProject project, String artifactId,
+                                                       String[] subConfiguration )
+    {
+        ArrayList configurationDomList = new ArrayList();
+        Xpp3Dom configuration = getPluginConfigurationDom( project, artifactId );
+        if ( configuration != null )
+        {
+            configurationDomList.add( configuration );
+            for ( int index = 0; !configurationDomList.isEmpty() && subConfiguration != null &&
+                index < subConfiguration.length; index++ )
+            {
+                ArrayList newConfigurationDomList = new ArrayList();
+                for ( Iterator childElement = configurationDomList.iterator(); childElement.hasNext(); )
                 {
-                    return o.getChild( optionName ).getValue();
+                    Xpp3Dom child = (Xpp3Dom) childElement.next();
+                    Xpp3Dom[] deeperChild = child.getChildren( subConfiguration[index] );
+                    for ( int deeperIndex = 0; deeperIndex < deeperChild.length; deeperIndex++ )
+                    {
+                        if ( deeperChild[deeperIndex] != null )
+                        {
+                            newConfigurationDomList.add( deeperChild[deeperIndex] );
+                        }
+                    }
                 }
+                configurationDomList = newConfigurationDomList;
             }
         }
-
-        return defaultValue;
+        return (Xpp3Dom[]) configurationDomList.toArray( new Xpp3Dom[configurationDomList.size()] );
     }
 
     public static String getProjectName( String template, IdeDependency dep )
@@ -197,7 +246,7 @@
 
     /**
      * Use the project name template to create an eclipse project.
-     *  
+     * 
      * @param template Template for the project name
      * @param artifact the artifact to create the project name for
      * @return the created ide project name
@@ -206,7 +255,7 @@
     {
         return getProjectName( template, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
     }
-    
+
     public static String getProjectName( String template, MavenProject project )
     {
         return getProjectName( template, project.getGroupId(), project.getArtifactId(), project.getVersion() );
@@ -215,13 +264,13 @@
     public static String getProjectName( IdeDependency dep, boolean addVersionToProjectName )
     {
         return getProjectName( addVersionToProjectName ? PROJECT_NAME_WITH_VERSION_TEMPLATE
-                                                      : PROJECT_NAME_DEFAULT_TEMPLATE, dep );
+                        : PROJECT_NAME_DEFAULT_TEMPLATE, dep );
     }
 
     public static String getProjectName( MavenProject project, boolean addVersionToProjectName )
     {
         return getProjectName( addVersionToProjectName ? PROJECT_NAME_WITH_VERSION_TEMPLATE
-                                                      : PROJECT_NAME_DEFAULT_TEMPLATE, project );
+                        : PROJECT_NAME_DEFAULT_TEMPLATE, project );
     }
 
     public static Artifact resolveArtifactWithClassifier( String groupId, String artifactId, String version,
@@ -311,11 +360,11 @@
     public static String toRelativeAndFixSeparator( File basedir, File fileToAdd, boolean replaceSlashesWithDashes )
         throws MojoExecutionException
     {
-        if ( ! fileToAdd.isAbsolute() )
+        if ( !fileToAdd.isAbsolute() )
         {
             fileToAdd = new File( basedir, fileToAdd.getPath() );
         }
-        
+
         String basedirpath;
         String absolutePath;
 
@@ -351,8 +400,7 @@
     /**
      * Returns a compiler plugin settings from a list of plugins .
      * 
-     * @param project
-     *            maven project
+     * @param project maven project
      * @return option value (may be null)
      */
     private static String findCompilerPluginSettingInPlugins( List plugins, String optionName )

Modified: maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/JeeUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/JeeUtils.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/JeeUtils.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/main/java/org/apache/maven/plugin/ide/JeeUtils.java Thu Nov  1 19:16:57 2007
@@ -25,6 +25,9 @@
 
 public class JeeUtils
 {
+    public static final String ARTIFACT_MAVEN_EAR_PLUGIN = "org.apache.maven.plugins:maven-ear-plugin"; //$NON-NLS-1$
+    public static final String ARTIFACT_MAVEN_WAR_PLUGIN = "org.apache.maven.plugins:maven-war-plugin"; //$NON-NLS-1$
+    
     private static final Map ejbMap = new HashMap();
 
     private static final Map jeeMap = new HashMap();

Added: maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt?rev=591192&view=auto
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt (added)
+++ maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt Thu Nov  1 19:16:57 2007
@@ -0,0 +1,296 @@
+ ------
+ Multi-module projects with WTP
+ ------
+ Roland Asmann
+ Richard van Nieuwenhoven
+ ------
+ 17 October 2007
+ ------
+
+Using maven-eclipse-plugin in multi-module projects with WTP
+
+ Developing Multi-module projects with Maven and Eclipse can be done efficiently
+ using the the best of both Maven 2 and Eclipse's WTP. 
+ 
+ Especially with projects that have EJB and EAR modules, it can be difficult to
+ use Maven 2.0 and WTP. There are however good solutions to these obstacles,
+ without losing any of the functionality of either Maven nor WTP.
+ 
+* The flat project structure
+
+ One of the major problems that occur when using Maven and Eclipse together, is
+ that Maven encourages the use of deep project structures, wheras eclipse can't
+ handle those. A solution to this problem is to force Maven to use the flat
+ structure:
+ 
++-----
+.....
+<modules>
+  <module>../module1</module>
+  <module>../module2</module>
+</modules>
+.....
++-----
+
+ This has some very big drawbacks: You will lose the posibillity to use several
+ of Maven's tools (eg the release-plugin), because these are unable to handle
+ flat strcutures.
+ 
+ The best approach is to do everything the way it was intended in Maven, and
+ let the maven-eclipse-plugin bend WTP to its will. Therefor, the recommendation
+ would be to use the deep structures:
+
++-----
+.....
+<modules>
+  <module>module1</module>
+  <module>module2</module>
+</modules>
+.....
++-----
+ 
+* The Example project
+
+ This project is an example of a multi-module projects, containing some JAR-, a
+ WAR- and an EAR-project. You can download it from {{{j2ee-simple.tar.gz}here}}.
+ The project is based on the j2ee-simple archetype.
+ 
+** Step by step
+
+ Folow the example steps to install the multi-module project in your Eclipse.
+ 
+  * create a new workspace with Eclipse 3.3 and WTP 2.0
+  
+  * define the <<<M2_REPO>>> variable in Eclipse
+  
+  * extract the example project somewhere
+  
+  * start '<<<mvn eclipse:eclipse install>>>' from the command-line in the root project (j2ee-simple)
+  
+  * use the {{Multi Project Import/Export Plugin}} to import all the modules into Eclipse
+  
+  * define your favourite application server in the WTP Server view
+  
+  * add and publish the project to the server 
+  
+  * start the server
+  
+  * open your browser to {{http://localhost:8080/servlet/hello}}
+  
+  * your maven project is up and running as a eclipse / wtp project
+
+* Source Control Management
+
+ Eclipse and Maven support a wide range of SCM systems (like CVS and SVN). The 
+ usage in a WTP/Maven project has some pecularities, which we will
+ discuss below.
+
+** Control files
+
+ Do not check in the Eclipse control files in your SCM, you can (and should)
+ regenerate them every time you need them!
+ 
+ When using CVS, put these files in the .cvsignore file of every module.
+ A basic version will look something like this:
+
++---
+.classpath
+.project
+.settings
+target
++---
+ 
+ For SVN, please check its documentation!
+ 
+** The organisation project
+
+ One solution to sharing the exact Maven configuration between all developers,
+ is to create a project containing the Maven binary release. This project can
+ also be included in the SCM system, so that any updates (be it a new version or
+ a configuration.change) are received by all developers.
+
+* {Multi Project Import/Export Plugin}
+
+ There is an Eclipe plugin available that can help a lot when using multi-module
+ projects. This plugin can import several projects at once, and it can do so from
+ both a deep and a flat structure.
+ 
+ The plugin is called "Multi Project Import/Export Plugin" and can be found
+ {{{http://eclipse-tools.sourceforge.net/}here}}. You can also reference the
+ update site in eclipse, using the URL: <<http://eclipse-tools.sourceforge.net/updates/>>
+
+* Project names
+
+ The project names in Eclipse do not have to be the same as the name of the 
+ folder. Instead of forcing Maven to generate artifacts without version name
+ (which is considered bad practice), the maven-eclipse-plugin can adapt the project
+ names to include the version name! This way the artifact Eclipse generates, will have
+ the same name as the artifact the Maven generates!
+ 
+ Many problems in the area of "the eclipse exported ear works, but the maven 
+ generated not" (or vice-versa) come from this different "final name"
+ problem.
+ 
+ The best way to evade such problems is to use this setting for the 
+ maven-eclipse-plugin:
+ 
++----
+<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
++----
+
+* The pom modules
+
+ The root of the projects in Maven is always a POM-module. These projects can be
+ imported into Eclipse as well, which then enables you to create and use
+ <<External Tool-launches>> with workspace-locations. This makes the launches
+ also exchangeable between developers and they can therefore also be stored in
+ SCM.
+
+** Duplicate folders
+
+ Some pecularities you will have to remember when you checked out the root pom
+ project in your workspace:
+ 
+  * first synchronize the modules
+  
+  * then <<refresh>> the pom project (this step is <<very>> important!)
+  
+  * then synchonize the root pom project \
+    (only necessary when the root pom changed or you created a new module)
+
+ Watch out that the files accessible in modules under the root pom project, are 
+ <<physically>> the same files as in the imported projects.
+ Eclipse will show the any changes after the next refresh.
+
+* Maven builds as launches
+
+ As was said above, it is very usefull to have your Maven builds inside Eclipse
+ as a Launch-configuration. To create these, you should create a new External Tool
+ and fill out the following values:
+ 
+  * Name:
+  
+    The name for the launch -- this can be chosen freely.
+    
+  * Location:
+  
++---
+    ${env_var:JAVA_HOME}/bin/java
++---
+    
+    If you're on Windows, you should add the '.exe' extension to the above command.
+
+    Or, if you really want to make the builds interoperable, all developers should
+    create a variable in their workspace called 'JAVA_EXECUTABLE', holding either
+    the value 'java' (linux) or 'java.exe' (windows). The above command can then
+    be changed into
+    
++---
+    ${env_var:JAVA_HOME}/bin/${JAVA_EXECUTABLE}
++---
+    
+  * Working Directory: 
+
+    Select the root pom project here.
+
++---
+    ${workspace_loc:/j2ee-simple}
++---
+    
+  * Arguments:
+  
+    In the example below, we presume you have made the organisation-project containing
+    the Maven distribution. The project is called 'organisation'.
+    
++---
+  -Dclassworlds.conf=${resource_loc:organisation/maven-2.0/bin/m2.conf}
+  -Dmaven.home=${resource_loc:organisation/maven-2.0}
+  -classpath ${resource_loc:organisation/maven-2.0/core/boot/classworlds-1.1.jar}
+   org.codehaus.classworlds.Launcher
+
+  -DdownloadSources=true
+  -Dmaven.test.skip=${string_prompt:maven.test.skip:false}
+   clean eclipse:clean eclipse:eclipse install
++---
+
+    The last three lines are configurations for plugins and the actual goals to
+    run. These can be changed if necessary.
+    
+    The second to last line is used to have Eclipse prompt for running or skipping
+    tests. Enter 'true' to skip the tests, anything else will run the tests.
+
+  * Refresh / Refresh resources upon completion
+  
+    Best to activate "The entire workspace" just to be sure all projects are aware
+    of changes.
+    
+  * Common / Save as Shared file
+  
+    Best to select the Root pom project location. The resulting launch file can 
+    be put under SCM control.
+
+* The EAR project
+
+ WTP saves some extra information in the application.xml that would otherwise be 
+ generated by the maven-ear-plugin. We do not want to interfere with the 
+ maven-ear-plugin, so the maven-eclipse-plugin generates a special application.xml 
+ for WTP. This enables you to use the WTP deployer in the server view.
+  
+ Important: this generated version of the application.xml will <<NOT>> be used in
+ the maven build.
+  
+* The EJB project
+
+ WTP automatically uses the ejbModule's source folder, but it is not mandatory.
+ Use the Maven location instead: 'src/main/resources' for the ejb-jar.xml (etc) and 
+ 'src/main/java' for the JAVA-beans.
+ 
+ TIP: if WTP can not read your deployment descriptor, check if you included a
+ 'display-name'-tag and specified the <xml encoding> in the xml file.
+
+* The WAR project
+
+ Early versions of WTP had some problems when no toplevel directory was used for
+ the webcontent. As of v1.5 this problem is no longer there! This enables using
+ the standard maven directory 'src/main/webapp' as the web-content folder. 
+ 
+ The WEB-INF/classes directory can still trigger problems, therefore it is best
+ <<not>> to include JAVA classes in a war module. Just put them in a separate
+ JAVA (JAR) module and a lot of undetermined problems disappear. 
+ 
+ WTP needs the context root in the war project, but in Maven it is defined in
+ the ear project. As long as the ear project is available in the reactor (as 
+ part of the same multi module build) the eclipse plugin will take the context
+ root from the ear project configuration. 
+
+* The Eclipse MANIFEST files
+
+ In Maven the manifest is generated by the maven-jar-plugin from the dependencies
+ just before packaging, but WTP needs them to run. The maven-eclipse-plugin will
+ generate a manifest that is available only to Eclipse (located at
+ 'target/generated-resources/eclipse/META-INF/MANIFEST.MF'), meaning that it will
+ be ignored in the normal maven build.
+ 
+* Deploying with WTP
+
+ When you followed all directions described here, there should be no problem to
+ deploy your EARs using the WTP tools for your application server. So there is no
+ need to start a maven build after every change. 
+
+* Finally
+
+ The configuration of the maven-eclipse-plugin used in this description is:
+ 
++-----
+	<plugin>
+		<groupId>org.apache.maven.plugins</groupId>
+		<artifactId>maven-eclipse-plugin</artifactId>
+		<configuration>
+			<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
+			<wtpmanifest>true</wtpmanifest>
+			<wtpapplicationxml>true</wtpapplicationxml>
+			<wtpversion>2.0</wtpversion>
+			<manifest>${basedir}/src/main/resources/META-INF/MANIFEST.MF</manifest>
+		</configuration>
+	</plugin>
++-----

Propchange: maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MECLIPSE-333/src/site/apt/examples/multi-module-projects.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/branches/MECLIPSE-333/src/site/resources/j2ee-simple.tar.gz
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/site/resources/j2ee-simple.tar.gz?rev=591192&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/branches/MECLIPSE-333/src/site/resources/j2ee-simple.tar.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: maven/plugins/branches/MECLIPSE-333/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/site/site.xml?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/site/site.xml (original)
+++ maven/plugins/branches/MECLIPSE-333/src/site/site.xml Thu Nov  1 19:16:57 2007
@@ -16,6 +16,7 @@
       <item name="Prevent Module References" href="examples/prevent-module-references.html"/>
       <item name="Attach Library Sources" href="examples/attach-library-sources.html"/>
       <item name="Provide Project Natures And Build Commands" href="examples/provide-project-natures-and-build-commands.html"/>
+      <item name="Multi-module projects with WTP" href="examples/multi-module-projects.html"/>
     </menu>
   </body>
 </project>

Modified: maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java Thu Nov  1 19:16:57 2007
@@ -68,8 +68,8 @@
     /**
      * Pom File
      */
-    protected static File PomFile = new File(getBasedir(),"pom.xml");
-    
+    protected static File PomFile = new File( getBasedir(), "pom.xml" );
+
     /**
      * Group-Id for running test builds.
      */
@@ -81,8 +81,7 @@
     protected static final String ARTIFACT_ID = "maven-eclipse-plugin";
 
     /**
-     * Version under which the plugin was installed to the test-time local repository for running 
-     * test builds.
+     * Version under which the plugin was installed to the test-time local repository for running test builds.
      */
     protected static final String VERSION = "test";
 
@@ -98,8 +97,7 @@
     {
         if ( !installed )
         {
-            System.out
-                .println( "*** Running test builds; output will be directed to: " + BUILD_OUTPUT_DIRECTORY + "\n" );
+            System.out.println( "*** Running test builds; output will be directed to: " + BUILD_OUTPUT_DIRECTORY + "\n" );
         }
 
         super.setUp();
@@ -136,11 +134,12 @@
             {
                 PluginTestTool pluginTestTool = (PluginTestTool) lookup( PluginTestTool.ROLE, "default" );
 
-                localRepositoryDirectory = pluginTestTool
-                    .preparePluginForUnitTestingWithMavenBuilds( PomFile, "test", localRepositoryDirectory );
+                localRepositoryDirectory =
+                    pluginTestTool.preparePluginForUnitTestingWithMavenBuilds( PomFile, "test",
+                                                                               localRepositoryDirectory );
 
-                System.out.println( "*** Installed test-version of the Eclipse plugin to: " + localRepositoryDirectory
-                    + "\n" );
+                System.out.println( "*** Installed test-version of the Eclipse plugin to: " + localRepositoryDirectory +
+                    "\n" );
 
                 installed = true;
             }
@@ -180,6 +179,7 @@
 
     /**
      * Execute the eclipse:eclipse goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @throws Exception any exception generated during test
      */
@@ -191,6 +191,7 @@
 
     /**
      * Execute the eclipse:eclipse goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @param properties additional properties
      * @throws Exception any exception generated during test
@@ -204,6 +205,7 @@
 
     /**
      * Execute the eclipse:eclipse goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @param properties additional properties
      * @param cleanGoal TODO
@@ -228,7 +230,8 @@
 
         MavenProject project = readProject( pom );
 
-        String outputDirPath = IdeUtils.getPluginSetting( project, "maven-eclipse-plugin", "outputDir", null );
+        String outputDirPath =
+            IdeUtils.getPluginSetting( project, "org.apache.maven.plugins:maven-eclipse-plugin", "outputDir", null );
         File outputDir;
         File projectOutputDir = basedir;
 
@@ -252,6 +255,7 @@
 
     /**
      * Execute the eclipse:configure-workspace goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @throws Exception any exception generated during test
      */
@@ -259,10 +263,11 @@
         throws Exception
     {
         testWorkspace( projectName, new Properties(), "configure-workspace" );
-    }    
-    
+    }
+
     /**
      * Execute the eclipse:configure-workspace goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @throws Exception any exception generated during test
      */
@@ -270,9 +275,11 @@
         throws Exception
     {
         testWorkspace( projectName, new Properties(), goal );
-    }        
+    }
+
     /**
      * Execute the eclipse:configure-workspace goal on a test project and verify generated files.
+     * 
      * @param projectName project directory
      * @param properties additional properties
      * @param cleanGoal TODO
@@ -296,7 +303,8 @@
 
         MavenProject project = readProject( pom );
 
-        String outputDirPath = IdeUtils.getPluginSetting( project, "maven-eclipse-plugin", "outputDir", null );
+        String outputDirPath =
+            IdeUtils.getPluginSetting( project, "org.apache.maven.plugins:maven-eclipse-plugin", "outputDir", null );
         File outputDir;
         File projectOutputDir = basedir;
 
@@ -311,20 +319,21 @@
             projectOutputDir = new File( outputDir, project.getArtifactId() );
         }
 
-        compareDirectoryContent( basedir, projectOutputDir, EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR + "/" );
+        compareDirectoryContent( basedir, projectOutputDir, EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR +
+            "/" );
 
     }
-    
-    protected File getOutputDirectory( String projectName ) 
+
+    protected File getOutputDirectory( String projectName )
     {
         return getTestFile( "target/test-classes/projects/" + projectName );
     }
-    
+
     protected File getTestWorkspaceWorkDirectory( String projectName )
     {
         return new File( this.getOutputDirectory( projectName ), ".metadata" );
     }
-    
+
     protected void executeMaven( File pom, Properties properties, List goals )
         throws TestToolsException, ExecutionFailedException
     {
@@ -387,9 +396,9 @@
             {
             }
 
-            throw new ExecutionFailedException( "Failed to execute build.\nPOM: " + pom + "\nGoals: "
-                + StringUtils.join( goals.iterator(), ", " ) + "\nExit Code: " + result.getExitCode() + "\nError: "
-                + result.getExecutionException() + "\nBuild Log: " + buildLogUrl + "\n", result );
+            throw new ExecutionFailedException( "Failed to execute build.\nPOM: " + pom + "\nGoals: " +
+                StringUtils.join( goals.iterator(), ", " ) + "\nExit Code: " + result.getExitCode() + "\nError: " +
+                result.getExecutionException() + "\nBuild Log: " + buildLogUrl + "\n", result );
         }
     }
 
@@ -403,14 +412,14 @@
     {
         String pluginSpec = GROUP_ID + ":" + ARTIFACT_ID + ":";
 
-        //        String pluginVersion = System.getProperty( "pluginVersion" );
+        // String pluginVersion = System.getProperty( "pluginVersion" );
         //        
-        //        if ( pluginVersion != null )
-        //        {
-        //            pluginSpec += pluginVersion + ":";
-        //        }
+        // if ( pluginVersion != null )
+        // {
+        // pluginSpec += pluginVersion + ":";
+        // }
         //
-        //        System.out.println( "\n\nUsing Eclipse plugin version: " + pluginVersion + "\n\n" );
+        // System.out.println( "\n\nUsing Eclipse plugin version: " + pluginVersion + "\n\n" );
 
         // try using the test-version installed during setUp()
         pluginSpec += VERSION + ":";
@@ -423,7 +432,7 @@
      * @param projectOutputDir
      * @throws IOException
      */
-    private void compareDirectoryContent( File basedir, File projectOutputDir, String additionalDir )
+    protected void compareDirectoryContent( File basedir, File projectOutputDir, String additionalDir )
         throws IOException
     {
         File expectedConfigDir = new File( basedir, "expected/" + additionalDir );
@@ -441,8 +450,8 @@
             for ( int j = 0; j < files.length; j++ )
             {
                 File expectedFile = files[j];
-                File actualFile = new File( projectOutputDir, additionalDir + expectedFile.getName() )
-                    .getCanonicalFile();
+                File actualFile =
+                    new File( projectOutputDir, additionalDir + expectedFile.getName() ).getCanonicalFile();
 
                 if ( !actualFile.exists() )
                 {
@@ -477,20 +486,21 @@
             // replace some vars in the expected line, to account
             // for absolute paths that are different on each installation.
             expected = StringUtils.replace( expected, "${basedir}", basedir );
-            expected = StringUtils.replace( expected, "${M2_REPO}", localRepositoryDirectory.getCanonicalPath()
-                .replace( '\\', '/' ) );
+            expected =
+                StringUtils.replace( expected, "${M2_REPO}", localRepositoryDirectory.getCanonicalPath().replace( '\\',
+                                                                                                                  '/' ) );
 
             if ( actualLines.size() <= i )
             {
-                fail( "Too few lines in the actual file. Was " + actualLines.size() + ", expected: "
-                    + expectedLines.size() );
+                fail( "Too few lines in the actual file. Was " + actualLines.size() + ", expected: " +
+                    expectedLines.size() );
             }
 
             String actual = actualLines.get( i ).toString();
 
             if ( expected.startsWith( "#" ) && actual.startsWith( "#" ) )
             {
-                //ignore comments, for settings file
+                // ignore comments, for settings file
                 continue;
             }
 

Modified: maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=591192&r1=591191&r2=591192&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java (original)
+++ maven/plugins/branches/MECLIPSE-333/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java Thu Nov  1 19:16:57 2007
@@ -18,48 +18,63 @@
  */
 package org.apache.maven.plugin.eclipse;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
 import java.util.Properties;
 
 import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
  * @version $Id$
  */
-public class EclipsePluginTest extends AbstractEclipsePluginTestCase
+public class EclipsePluginTest
+    extends AbstractEclipsePluginTestCase
 {
     protected void setUp()
-    throws Exception
+        throws Exception
     {
         super.setUp();
     }
-    public void testProject01() throws Exception
+
+    public void testProject01()
+        throws Exception
     {
         testProject( "project-01" );
     }
 
-    public void testProject02() throws Exception
+    public void testProject02()
+        throws Exception
     {
         testProject( "project-02" );
     }
 
-    public void testProject03() throws Exception
+    public void testProject03()
+        throws Exception
     {
         testProject( "project-03" );
     }
 
-    public void testProject04() throws Exception
+    public void testProject04()
+        throws Exception
     {
         testProject( "project-04" );
     }
 
-    public void testProject05() throws Exception
+    public void testProject05()
+        throws Exception
     {
         testProject( "project-05" );
     }
 
-    public void testProject06() throws Exception
+    public void testProject06()
+        throws Exception
     {
         testProject( "project-06" );
     }
@@ -74,7 +89,8 @@
     // testProject( "project-07" );
     // }
 
-    public void testProject08() throws Exception
+    public void testProject08()
+        throws Exception
     {
         testProject( "project-08" );
     }
@@ -84,17 +100,20 @@
      * 
      * @throws Exception
      */
-    public void testProject09() throws Exception
+    public void testProject09()
+        throws Exception
     {
         testProject( "project-09" );
     }
 
-    public void testProject10() throws Exception
+    public void testProject10()
+        throws Exception
     {
         testProject( "project-10" );
     }
 
-    public void testProject11() throws Exception
+    public void testProject11()
+        throws Exception
     {
         testProject( "project-11" );
     }
@@ -102,10 +121,10 @@
     /**
      * Ear packaging
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject12() throws Exception
+    public void testProject12()
+        throws Exception
     {
         testProject( "project-12" );
     }
@@ -113,10 +132,10 @@
     /**
      * Dependency range - MECLIPSE-96
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject13() throws Exception
+    public void testProject13()
+        throws Exception
     {
         testProject( "project-13" );
     }
@@ -124,10 +143,10 @@
     /**
      * Additional natures and builders - MECLIPSE-64
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject14() throws Exception
+    public void testProject14()
+        throws Exception
     {
         testProject( "project-14" );
     }
@@ -135,10 +154,10 @@
     /**
      * <code>outputDirectory</code> parameter - MECLIPSE-11
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject15() throws Exception
+    public void testProject15()
+        throws Exception
     {
         Properties props = new Properties();
         props.put( "outputDirectory", "bin" );
@@ -170,10 +189,10 @@
     /**
      * relative location of system dependencies - MECLIPSE-89
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject18() throws Exception
+    public void testProject18()
+        throws Exception
     {
         testProject( "project-18" );
     }
@@ -181,10 +200,10 @@
     /**
      * Resource targetPath is relative to the project's output directory - MECLIPSE-77
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject19() throws Exception
+    public void testProject19()
+        throws Exception
     {
         testProject( "project-19" );
     }
@@ -192,10 +211,10 @@
     /**
      * WTP 1.5 changes in wtpmodules.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject20() throws Exception
+    public void testProject20()
+        throws Exception
     {
         testProject( "project-20" );
     }
@@ -203,10 +222,10 @@
     /**
      * PDE support.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject21() throws Exception
+    public void testProject21()
+        throws Exception
     {
         testProject( "project-21" );
     }
@@ -214,10 +233,10 @@
     /**
      * PDE support using eclipse-plugin packaging.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject22() throws Exception
+    public void testProject22()
+        throws Exception
     {
         testProject( "project-22" );
     }
@@ -225,10 +244,10 @@
     /**
      * Additional config files using "additionalConfig" property.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject23() throws Exception
+    public void testProject23()
+        throws Exception
     {
         testProject( "project-23" );
     }
@@ -236,10 +255,10 @@
     /**
      * Test rewriting of OSGI manifest files.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject24() throws Exception
+    public void testProject24()
+        throws Exception
     {
         testProject( "project-24" );
     }
@@ -247,10 +266,10 @@
     /**
      * Test source exclude/include.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject25() throws Exception
+    public void testProject25()
+        throws Exception
     {
         testProject( "project-25" );
     }
@@ -258,10 +277,10 @@
     /**
      * Test different compiler settings for test sources.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject26() throws Exception
+    public void testProject26()
+        throws Exception
     {
         testProject( "project-26" );
     }
@@ -269,10 +288,10 @@
     /**
      * Test additional project facets specified.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject27() throws Exception
+    public void testProject27()
+        throws Exception
     {
         testProject( "project-27" );
     }
@@ -280,10 +299,10 @@
     /**
      * MECLIPSE-241 : Compiler settings from parent project aren't used in wtp facet.
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject28() throws Exception
+    public void testProject28()
+        throws Exception
     {
         testProject( "project-28/module-1" );
     }
@@ -291,10 +310,10 @@
     /**
      * MECLIPSE-198 : EJB version is not resloved
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject29() throws Exception
+    public void testProject29()
+        throws Exception
     {
         testProject( "project-29" );
     }
@@ -302,72 +321,124 @@
     /**
      * MECLIPSE-108 : .wtpmodules with version 2.4 for javax.servlet:servlet-api:2.3
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject30() throws Exception
+    public void testProject30()
+        throws Exception
     {
         testProject( "project-30" );
     }
-    
+
     /**
      * MECLIPSE-185 : plugin doesn't fail when dependencies are missing
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject31() throws Exception
+    public void testProject31()
+        throws Exception
     {
-        try 
+        try
         {
             testProject( "project-31" );
-           
-            //disabling this test for now. See comments in MECLIPSE-185 - Bfox
+
+            // disabling this test for now. See comments in MECLIPSE-185 - Bfox
             // fail("Expected to receive a MojoExecutionException");
         }
-        catch (MojoExecutionException e)
+        catch ( MojoExecutionException e )
         {
-            //expected exception here
+            // expected exception here
         }
     }
 
     /**
      * MECLIPSE-109 : .component wb-resource source path incorrect for ear packaging
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    public void testProject32() throws Exception
+    public void testProject32()
+        throws Exception
     {
         testProject( "project-32" );
     }
-    
-    public void testProject34() throws Exception
+
+    public void testProject34()
+        throws Exception
     {
         testProject( "project-34" );
     }
-    
+
+    public void testJeeSimple()
+        throws Exception
+    {
+        testProject( "j2ee-simple" );
+
+        File basedir = getTestFile( "target/test-classes/projects/j2ee-simple" );
+
+        checkContextRoot( basedir, "servlets/servlet", "ear", "servlet" );
+
+    }
+
+    public void testProject35()
+        throws Exception
+    {
+        testProject( "project-35" );
+
+        File basedir = getTestFile( "target/test-classes/projects/project-35" );
+
+        checkContextRoot( basedir, "multymodule-war", "multymodule-ear", "/somethingVeryDifferent" );
+
+    }
+
+    private void checkContextRoot( File basedir, String warModule, String earModule, String expectedContextRoot )
+        throws FileNotFoundException, XmlPullParserException, IOException
+    {
+        FileReader reader =
+            new FileReader( new File( basedir, warModule + "/.settings/org.eclipse.wst.common.component" ) );
+        Xpp3Dom warComponent = Xpp3DomBuilder.build( reader );
+        Xpp3Dom[] properties = warComponent.getChild( "wb-module" ).getChildren( "property" );
+        boolean contextRootAvaliable = false;
+        for ( int index = 0; index < properties.length; index++ )
+        {
+            if ( properties[index].getAttribute( "name" ).equals( "context-root" ) )
+            {
+                assertEquals( "Context root detection in org.eclipse.wst.common.component", expectedContextRoot,
+                              properties[index].getAttribute( "value" ) );
+                contextRootAvaliable = true;
+            }
+        }
+        assertTrue( "there must be a context root here", contextRootAvaliable );
+
+        reader = new FileReader( new File( basedir, earModule + "/target/eclipseEar/META-INF/application.xml" ) );
+        Xpp3Dom generatedApplicationXML = Xpp3DomBuilder.build( reader );
+
+        Xpp3Dom[] modules = generatedApplicationXML.getChildren( "module" );
+        for ( int index = 0; index < modules.length; index++ )
+        {
+            if ( modules[index].getChild( "web" ) != null )
+            {
+                assertEquals( "Context root detection in target/eclipseEar/META-INF/application.xml",
+                              expectedContextRoot,
+                              modules[index].getChild( "web" ).getChild( "context-root" ).getValue() );
+            }
+        }
+    }
+
     /**
-     * MECLIPSE-287 : dependencies with and without classifiers
-     * MECLIPSE-151 : test jar source attachments
+     * MECLIPSE-287 : dependencies with and without classifiers MECLIPSE-151 : test jar source attachments
      * 
-     * @throws Exception
-     *             any exception thrown during test
+     * @throws Exception any exception thrown during test
      */
-    /*@TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
-     wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
-     file-comparing step which at the moment just does line by line comparison   
-    project 7 is affected by this as well.
-    public void testProject33() throws Exception
-    {
-            testProject( "project-33" );
-    }*/
-    
-    
-    /*TODO: Add a test for downloadJavadocs. Currently, eclipse doesn't support having variables in the javadoc
-     * path. This means that the expected .classpath can't match the final result as the result will
-     * have the absolute path to the user's local repo.
+    /*
+     * @TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
+     * wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
+     * file-comparing step which at the moment just does line by line comparison project 7 is affected by this as well.
+     * public void testProject33() throws Exception { testProject( "project-33" ); }
      */
-    
-    
+
+    /*
+     * TODO: Add a test for downloadJavadocs. Currently, eclipse doesn't support having variables in the javadoc path.
+     * This means that the expected .classpath can't match the final result as the result will have the absolute path to
+     * the user's local repo.
+     */
+
 }