added maven.eclipse.resources.addtoclasspath switch to provide backwards compatibilty
with older project structures using the plugin. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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' />
|
||||
|
||||
@@ -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,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
|
||||
@@ -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>
|
||||
|
||||
@@ -81,6 +81,14 @@
|
||||
the classpath, like <code>src/conf</code>.
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user