Author: aheritier
Date: Thu Jun 28 12:23:20 2007
New Revision: 551670
URL: http://svn.apache.org/viewvc?view=rev&rev=551670
Log:
MECLIPSE-109 : .component wb-resource source path incorrect for ear packaging
+ fix also relative path if warSrcDirectory is defined in the war plugin
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
(with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/.component
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
(with props)
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.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/resources/projects/project-12/expected/.settings/.component
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
Thu Jun 28 12:23:20 2007
@@ -74,6 +74,8 @@
protected static final String ELT_PROJECT_MODULES = "project-modules";
//$NON-NLS-1$
protected static final String ARTIFACT_MAVEN_WAR_PLUGIN =
"maven-war-plugin"; //$NON-NLS-1$
+
+ protected static final String ARTIFACT_MAVEN_EAR_PLUGIN =
"maven-ear-plugin"; //$NON-NLS-1$
/**
* @param project
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java
Thu Jun 28 12:23:20 2007
@@ -18,20 +18,19 @@
*/
package org.apache.maven.plugin.eclipse.writers.wtp;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
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.eclipse.writers.EclipseWriter;
import org.apache.maven.plugin.ide.IdeUtils;
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.FileWriter;
+import java.io.IOException;
+
/**
* Creates a .settings folder for Eclipse WTP 1.x release and writes out the
configuration under it.
*
@@ -134,15 +133,14 @@
String warSourceDirectory = IdeUtils.getPluginSetting(
config.getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
"warSourceDirectory", //$NON-NLS-1$
-
"/src/main/webapp" ); //$NON-NLS-1$
+
config.getProject().getBasedir()+"/src/main/webapp" ); //$NON-NLS-1$
writeContextRoot( writer );
writer.startElement( ELT_WB_RESOURCE );
writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$
writer.addAttribute( ATTR_SOURCE_PATH, IdeUtils
- .toRelativeAndFixSeparator( config.getProject().getBasedir(),
new File( config
- .getEclipseProjectDirectory(), warSourceDirectory ), false
) );
+ .toRelativeAndFixSeparator(
config.getEclipseProjectDirectory(), new File( warSourceDirectory ), false ) );
writer.endElement();
// @todo is this really needed?
@@ -155,9 +153,13 @@
}
else if ( "ear".equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
{
+ String earSourceDirectory = IdeUtils.getPluginSetting(
config.getProject(), ARTIFACT_MAVEN_EAR_PLUGIN,
+
"earSourceDirectory", //$NON-NLS-1$
+
config.getProject().getBasedir()+"/src/main/application" ); //$NON-NLS-1$
writer.startElement( ELT_WB_RESOURCE );
writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$
- writer.addAttribute( ATTR_SOURCE_PATH, "/" ); //$NON-NLS-1$
+ writer.addAttribute( ATTR_SOURCE_PATH, IdeUtils
+ .toRelativeAndFixSeparator(
config.getEclipseProjectDirectory(), new File( earSourceDirectory ), false ) );
writer.endElement();
}
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
Thu Jun 28 12:23:20 2007
@@ -18,20 +18,19 @@
*/
package org.apache.maven.plugin.eclipse.writers.wtp;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.Messages;
-import org.apache.maven.plugin.eclipse.writers.EclipseWriter;
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.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map.Entry;
/**
* Creates a .settings folder for Eclipse WTP 1.x release and writes out the
configuration under it.
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java
Thu Jun 28 12:23:20 2007
@@ -18,19 +18,18 @@
*/
package org.apache.maven.plugin.eclipse.writers.wtp;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
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.eclipse.writers.EclipseWriter;
import org.apache.maven.plugin.ide.IdeUtils;
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.FileWriter;
+import java.io.IOException;
+
/**
* Writes eclipse .wtpmodules file.
*
@@ -79,13 +78,12 @@
{
String warSourceDirectory = IdeUtils.getPluginSetting(
config.getProject(), ARTIFACT_MAVEN_WAR_PLUGIN,
"warSourceDirectory", //$NON-NLS-1$
-
"/src/main/webapp" ); //$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( config
- .getEclipseProjectDirectory(), warSourceDirectory ), false
) );
+ + IdeUtils.toRelativeAndFixSeparator(
config.getEclipseProjectDirectory(), new File( warSourceDirectory ), false ) );
writer.endElement();
writeWarOrEarResources( writer, config.getProject(),
config.getLocalRepository() );
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
Thu Jun 28 12:23:20 2007
@@ -303,4 +303,14 @@
testProject( "project-30" );
}
+ /**
+ * MECLIPSE-109 : .component wb-resource source path incorrect for ear
packaging
+ *
+ * @throws Exception
+ * any exception thrown during test
+ */
+ public void testProject32() throws Exception
+ {
+ testProject( "project-32" );
+ }
}
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-12/expected/.settings/.component
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-12/expected/.settings/.component?view=diff&rev=551670&r1=551669&r2=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-12/expected/.settings/.component
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-12/expected/.settings/.component
Thu Jun 28 12:23:20 2007
@@ -1,5 +1,5 @@
<project-modules id="moduleCoreId">
<wb-module deploy-name="maven-eclipse-plugin-test-project-12">
- <wb-resource deploy-path="/" source-path="/"/>
+ <wb-resource deploy-path="/" source-path="src/main/application"/>
</wb-module>
</project-modules>
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project?view=auto&rev=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
Thu Jun 28 12:23:20 2007
@@ -0,0 +1,14 @@
+<projectDescription>
+ <name>maven-eclipse-plugin-test-project-32</name>
+ <comment>Test for MECLIPSE-109</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ </natures>
+</projectDescription>
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.project
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/.component
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/.component?view=auto&rev=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/.component
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/expected/.settings/.component
Thu Jun 28 12:23:20 2007
@@ -0,0 +1,5 @@
+<project-modules id="moduleCoreId">
+ <wb-module deploy-name="maven-eclipse-plugin-test-project-32">
+ <wb-resource deploy-path="/" source-path="src/main/application2"/>
+ </wb-module>
+</project-modules>
\ No newline at end of file
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml?view=auto&rev=551670
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
Thu Jun 28 12:23:20 2007
@@ -0,0 +1,30 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>eclipse</groupId>
+ <artifactId>maven-eclipse-plugin-test-project-32</artifactId>
+ <version>12</version>
+ <packaging>ear</packaging>
+ <description>Test for MECLIPSE-109</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+
<earSourceDirectory>${basedir}/src/main/application2</earSourceDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>test</version>
+ <configuration>
+ <wtpversion>1.0</wtpversion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-32/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"