Author: fgiust
Date: Thu Apr 6 03:21:29 2006
New Revision: 391954
URL: http://svn.apache.org/viewcvs?rev=391954&view=rev
Log:
MECLIPSE-77 Resource targetPath is relative to the project's output directory.
(also fixing old buggy test cases that expected targetPath to be relative to
base dir)
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/classpath
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
(with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/project
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.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/projects/project-3/classpath
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/pom.xml
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/classpath
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/pom.xml
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/classpath
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/pom.xml
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
Thu Apr 6 03:21:29 2006
@@ -609,8 +609,10 @@
extractSourceDirs( directories, project.getCompileSourceRoots(),
basedir, projectBaseDir, false, null );
+ String relativeOutput = IdeUtils.toRelativeAndFixSeparator(
projectBaseDir, buildOutputDirectory, false );
+
extractResourceDirs( directories, project.getBuild().getResources(),
project, basedir, projectBaseDir, false,
- null );
+ relativeOutput );
// If using the standard output location, don't mix the test output
into it.
String testOutput = null;
@@ -692,11 +694,6 @@
// );
// }
- if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
- {
- output = resource.getTargetPath();
- }
-
File resourceDirectory = new File( resource.getDirectory() );
if ( !resourceDirectory.exists() ||
!resourceDirectory.isDirectory() )
@@ -712,6 +709,14 @@
File outputFile = new File( projectBaseDir, output );
// create output dir if it doesn't exist
outputFile.mkdirs();
+
+ if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
+ {
+ outputFile = new File( outputFile,
resource.getTargetPath() );
+ // create output dir if it doesn't exist
+ outputFile.mkdirs();
+ }
+
output = IdeUtils.toRelativeAndFixSeparator( projectBaseDir,
outputFile, false );
}
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
Thu Apr 6 03:21:29 2006
@@ -116,6 +116,8 @@
writer.startElement( ELT_CLASSPATH );
+ String defaultOutput = IdeUtils.toRelativeAndFixSeparator(
projectBaseDir, buildOutputDirectory, false );
+
//
----------------------------------------------------------------------
// Source roots and resources
//
----------------------------------------------------------------------
@@ -128,7 +130,7 @@
writer.addAttribute( ATTR_KIND, "src" ); //$NON-NLS-1$
writer.addAttribute( ATTR_PATH, dir.getPath() );
- if ( dir.getOutput() != null )
+ if ( dir.getOutput() != null && !defaultOutput.equals(
dir.getOutput() ) )
{
writer.addAttribute( ATTR_OUTPUT, dir.getOutput() );
}
@@ -143,8 +145,7 @@
writer.startElement( ELT_CLASSPATHENTRY );
writer.addAttribute( ATTR_KIND, ATTR_OUTPUT );
- writer.addAttribute( ATTR_PATH, IdeUtils
- .toRelativeAndFixSeparator( projectBaseDir, buildOutputDirectory,
false ) );
+ writer.addAttribute( ATTR_PATH, defaultOutput );
writer.endElement();
//
----------------------------------------------------------------------
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
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 Apr 6 03:21:29 2006
@@ -172,4 +172,14 @@
testProject( "project-18" );
}
+ /**
+ * Resource targetPath is relative to the project's output directory -
MECLIPSE-77
+ * @throws Exception any exception thrown during test
+ */
+ public void testProject19()
+ throws Exception
+ {
+ testProject( "project-19" );
+ }
+
}
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/classpath
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/classpath?rev=391954&view=auto
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/classpath
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/classpath
Thu Apr 6 03:21:29 2006
@@ -0,0 +1,5 @@
+<classpath>
+ <classpathentry kind="src" path="." output="target/classes/resourceoutput"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml?rev=391954&view=auto
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
Thu Apr 6 03:21:29 2006
@@ -0,0 +1,23 @@
+<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-19</artifactId>
+ <version>19</version>
+ <name>maven-eclipse-plugin-test-project-19</name>
+ <build>
+ <resources>
+ <resource>
+ <targetPath>resourceoutput</targetPath>
+ <directory>.</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration></configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/project
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/project?rev=391954&view=auto
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/project
(added)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-19/project
Thu Apr 6 03:21:29 2006
@@ -0,0 +1,14 @@
+<projectDescription>
+ <name>maven-eclipse-plugin-test-project-19</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments/>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/classpath
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/classpath?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/classpath
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/classpath
Thu Apr 6 03:21:29 2006
@@ -1,6 +1,6 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"
output="target/main-resources"/>
+ <classpathentry kind="src" path="src/main/resources"
output="target/classes/main-resources"/>
<classpathentry kind="src" path="src/test/resources"
output="target/test-output-dir"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/pom.xml?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/pom.xml
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-3/pom.xml
Thu Apr 6 03:21:29 2006
@@ -24,7 +24,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
- <targetPath>target/main-resources</targetPath>
+ <targetPath>main-resources</targetPath>
<includes>
<include>**/*.xml</include>
</includes>
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/classpath
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/classpath?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/classpath
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/classpath
Thu Apr 6 03:21:29 2006
@@ -1,6 +1,6 @@
<classpath>
<classpathentry kind="src" path="src-main-java"/>
- <classpathentry kind="src" path="src-main-resources"
output="target/main-resources"/>
+ <classpathentry kind="src" path="src-main-resources"
output="target/classes/main-resources"/>
<classpathentry kind="src" path="src-test-java"
output="target/test-classes-dir"/>
<classpathentry kind="src" path="src-test-resources"
output="target/test-classes-dir"/>
<classpathentry kind="output" path="target/classes"/>
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/pom.xml?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/pom.xml
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-4/pom.xml
Thu Apr 6 03:21:29 2006
@@ -18,7 +18,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
- <targetPath>target/main-resources</targetPath>
+ <targetPath>main-resources</targetPath>
</resource>
</resources>
<plugins>
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/classpath
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/classpath?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/classpath
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/classpath
Thu Apr 6 03:21:29 2006
@@ -1,6 +1,6 @@
<classpath>
<classpathentry kind="src" path="src-main-java"/>
- <classpathentry kind="src" path="src-main-resources"
output="target/main-resources"/>
+ <classpathentry kind="src" path="src-main-resources"
output="target/eclipse-classes/main-resources"/>
<classpathentry kind="src" path="src-test-java"/>
<classpathentry kind="src" path="src-test-resources"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/pom.xml?rev=391954&r1=391953&r2=391954&view=diff
==============================================================================
---
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/pom.xml
(original)
+++
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-9/pom.xml
Thu Apr 6 03:21:29 2006
@@ -18,7 +18,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
- <targetPath>target/main-resources</targetPath>
+ <targetPath>main-resources</targetPath>
</resource>
</resources>
<plugins>