epugh 2004/10/26 00:57:06
Modified: eclipse plugin.properties
eclipse/src/plugin-resources/templates classpath.jelly
eclipse/src/plugin-test project.properties maven.xml
eclipse/xdocs changes.xml properties.xml
Log:
added maven.eclipse.resources.addtoclasspath switch to provide backwards compatibilty
with older project structures using the plugin.
Revision Changes Path
1.9 +1 -0 maven-plugins/eclipse/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven-plugins/eclipse/plugin.properties,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- plugin.properties 20 Oct 2004 18:23:11 -0000 1.8
+++ plugin.properties 26 Oct 2004 07:57:06 -0000 1.9
@@ -26,3 +26,4 @@
maven.eclipse.goals = plugins
maven.gen.src=${maven.build.dir}/generated-sources
maven.eclipse.src.extension = zip
+maven.eclipse.resources.addtoclasspath=false
1.31 +35 -32
maven-plugins/eclipse/src/plugin-resources/templates/classpath.jelly
Index: classpath.jelly
===================================================================
RCS file:
/home/cvs/maven-plugins/eclipse/src/plugin-resources/templates/classpath.jelly,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- classpath.jelly 22 Oct 2004 05:40:54 -0000 1.30
+++ classpath.jelly 26 Oct 2004 07:57:06 -0000 1.31
@@ -59,23 +59,24 @@
</j:if>
</j:forEach>
<classpathentry kind="src" path="${srcDir}" excluding="${excluding}" />
-
- <j:if test="${!pom.build.resources.isEmpty()}">
- <j:forEach var="resource" items="${pom.build.resources}">
- <j:set var="includingAsString" value="" />
- <j:forEach var="res" items="${resource.includes}">
- <j:set var="includingAsString" value="${includingAsString}${res}|" />
+ <j:if test="${maven.eclipse.resources.addtoclasspath}">
+ <j:if test="${!pom.build.resources.isEmpty()}">
+ <j:forEach var="resource" items="${pom.build.resources}">
+ <j:set var="includingAsString" value="" />
+ <j:forEach var="res" items="${resource.includes}">
+ <j:set var="includingAsString" value="${includingAsString}${res}|" />
+ </j:forEach>
+ <j:set var="excludingAsString" value="" />
+ <j:forEach var="res" items="${resource.excludes}">
+ <j:set var="excludingAsString" value="${excludingAsString}${res}|" />
+ </j:forEach>
+ <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}"
path="${resource.directory}" separator="/"/>
+ <!-- don't add duplicate directories -->
+ <j:if test="${!resourceDirectory.equals(srcDir) and
(!resourceDirectory.equals(testSrcDir) or !unitTestSourcesPresent)}">
+ <classpathentry kind="src" path="${resourceDirectory}"
including="${includingAsString}" excluding="${excludingAsString}" />
+ </j:if>
</j:forEach>
- <j:set var="excludingAsString" value="" />
- <j:forEach var="res" items="${resource.excludes}">
- <j:set var="excludingAsString" value="${excludingAsString}${res}|" />
- </j:forEach>
- <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}"
path="${resource.directory}" separator="/"/>
- <!-- don't add duplicate directories -->
- <j:if test="${!resourceDirectory.equals(srcDir) and
(!resourceDirectory.equals(testSrcDir) or !unitTestSourcesPresent)}">
- <classpathentry kind="src" path="${resourceDirectory}"
including="${includingAsString}" excluding="${excludingAsString}" />
- </j:if>
- </j:forEach>
+ </j:if>
</j:if>
</j:if>
@@ -136,24 +137,26 @@
</j:if>
<j:if test="${pom.build.unitTest != null}">
- <j:if test="${!pom.build.unitTest.resources.isEmpty()}">
- <j:forEach var="resource" items="${pom.build.unitTest.resources}">
- <j:set var="includingAsString" value="" />
- <j:forEach var="res" items="${resource.includes}">
- <j:set var="includingAsString" value="${includingAsString}${res}|" />
+ <j:if test="${maven.eclipse.resources.addtoclasspath}">
+ <j:if test="${!pom.build.unitTest.resources.isEmpty()}">
+ <j:forEach var="resource" items="${pom.build.unitTest.resources}">
+ <j:set var="includingAsString" value="" />
+ <j:forEach var="res" items="${resource.includes}">
+ <j:set var="includingAsString" value="${includingAsString}${res}|" />
+ </j:forEach>
+ <j:set var="excludingAsString" value="" />
+ <j:forEach var="res" items="${resource.excludes}">
+ <j:set var="excludingAsString" value="${excludingAsString}${res}|" />
+ </j:forEach>
+ <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}"
path="${resource.directory}" separator="/"/>
+ <!-- don't add duplicate directories -->
+ <j:if test="${!resourceDirectory.equals(testSrcDir) and
(!resourceDirectory.equals(srcDir) or !sourcesPresent)}">
+ <classpathentry kind="src" path="${resourceDirectory}"
output="${testOutputDir}" including="${includingAsString}"
excluding="${excludingAsString}"/>
+ </j:if>
</j:forEach>
- <j:set var="excludingAsString" value="" />
- <j:forEach var="res" items="${resource.excludes}">
- <j:set var="excludingAsString" value="${excludingAsString}${res}|" />
- </j:forEach>
- <maven:makeRelativePath var="resourceDirectory" basedir="${basedir}"
path="${resource.directory}" separator="/"/>
- <!-- don't add duplicate directories -->
- <j:if test="${!resourceDirectory.equals(testSrcDir) and
(!resourceDirectory.equals(srcDir) or !sourcesPresent)}">
- <classpathentry kind="src" path="${resourceDirectory}"
output="${testOutputDir}" including="${includingAsString}"
excluding="${excludingAsString}"/>
- </j:if>
- </j:forEach>
+ </j:if>
</j:if>
- </j:if>
+ </j:if>
</j:if>
<maven:get var="cactusSrcDir" plugin='cactus-maven' property='cactus.src.dir' />
1.4 +1 -0 maven-plugins/eclipse/src/plugin-test/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-test/project.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- project.properties 22 Oct 2004 06:01:38 -0000 1.3
+++ project.properties 26 Oct 2004 07:57:06 -0000 1.4
@@ -1,3 +1,4 @@
cactus.src.dir=${basedir}/src/cactus-test
maven.jar.override=on
maven.jar.commons-dude=${maven.repo.local}/commons-logging/jars/commons-logging-1.0.3.jar
+maven.eclipse.resources.addtoclasspath=true
\ No newline at end of file
1.21 +18 -1 maven-plugins/eclipse/src/plugin-test/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-test/maven.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- maven.xml 23 Oct 2004 15:52:51 -0000 1.20
+++ maven.xml 26 Oct 2004 07:57:06 -0000 1.21
@@ -21,7 +21,7 @@
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml">
- <goal name="testPlugin"
prereqs="test-eclipse,test-natures,test-builders,test-natures-and-builders,test-classpath-has-generated-source,test-classpath-has-overridden-jar,test-noduplicates,test-classpath-con-entry">
+ <goal name="testPlugin"
prereqs="test-eclipse,test-natures,test-builders,test-natures-and-builders,test-classpath-has-generated-source,test-classpath-has-overridden-jar,test-noduplicates,test-classpath-con-entry,test-classpath-no-resources">
</goal>
<goal name="test-init">
@@ -169,5 +169,22 @@
<x:set var="countConEntries"
select="count($classpathDoc/classpath/classpathentry[contains(@kind,'con')])"/>
<assert:assertEquals expected="2"
value="${countConEntries.intValue().toString()}" msg="Classpath entry kind='con'
should be added twice, once mandatory, other variable"/>
</goal>
+
+ <goal name="test-classpath-no-resources">
+ <attainGoal name="test-init"/>
+ <j:set var="maven.eclipse.resources.addtoclasspath" value="false"/>
+ <attainGoal name="eclipse"/>
+
+ <assert:assertFileExists file="${dotProject}" />
+ <assert:assertFileExists file="${dotClasspath}" />
+
+ <u:file var="classpathFile" name="${dotClasspath}"/>
+ <x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
+ <x:set var="count"
select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/resources')])"/>
+ <assert:assertEquals expected="0" value="${count.intValue().toString()}"
msg="The src/resources dir should not be imported"/>
+
+ <x:set var="count"
select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/test-resources')])"/>
+ <assert:assertEquals expected="0" value="${count.intValue().toString()}"
msg="The src/test-resources dir should not be imported"/>
+ </goal>
</project>
1.38 +1 -0 maven-plugins/eclipse/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/eclipse/xdocs/changes.xml,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- changes.xml 22 Oct 2004 06:01:39 -0000 1.37
+++ changes.xml 26 Oct 2004 07:57:06 -0000 1.38
@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.9-SNAPSHOT" date="in cvs">
+ <action dev="epugh" type="add">Add property
<code>maven.eclipse.resources.addtoclasspath</code> to control whether to add
pom.resources etc or not. Provide backwards compatiblity.</action>
<action dev="felipeal" type="fix" issue="MPECLIPSE-52">Set proper
<code>cactus.src.dir</code></action>
<action dev="felipeal" type="fix" issue="MPECLIPSE-51">Fixed duplicated
source entry issue.</action>
<action dev="epugh" type="add">add property maven.eclipse.addResources=false
to prevent the build resources from breaking old Eclipse builds.</action>
1.14 +8 -0 maven-plugins/eclipse/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven-plugins/eclipse/xdocs/properties.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- properties.xml 19 Oct 2004 11:55:28 -0000 1.13
+++ properties.xml 26 Oct 2004 07:57:06 -0000 1.14
@@ -82,6 +82,14 @@
</td>
</tr>
<tr>
+ <td>maven.eclipse.resources.addtoclasspath</td>
+ <td>Yes</td>
+ <td>
+ Specify whether to include the resources defined in the POM in the
+ Eclipse classpath. Defaults to false.
+ </td>
+ </tr>
+ <tr>
<td>maven.eclipse.conclasspath</td>
<td>Yes</td>
<td>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]