Turn off the inclusion of pom build resources by default.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2004-10-19 14:13:04 +00:00
parent ac4c80304a
commit cdc0b6da87
5 changed files with 46 additions and 5 deletions

View File

@@ -31,7 +31,7 @@
<define:tag name="write-classpath-entry">
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
<maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
<maven:param-check value="${version}" fail="true" message="'version' must be specified"/>
<maven:param-check value="${version}" fail="false" message="'version' should be specified for artifact ${groupId}.${artifactId}"/>
<!-- relativePath is optional, used for jar override -->
<j:set var="relativePathCheck" value="${relativePath}X" />

View File

@@ -26,3 +26,4 @@
maven.eclipse.goals = plugins
maven.gen.src=${maven.build.dir}/generated-sources
maven.eclipse.src.extension = zip
maven.eclipse.addResources=false

View File

@@ -57,14 +57,25 @@
<classpathentry kind="src" path="${srcDir}" excluding="${excluding}" />
<j:if test="${!pom.build.resources.isEmpty()}">
<!-- Turn off for most users this buggy code-->
<j:if test="${maven.eclipse.addResources == 'true'}">
<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)}">
<classpathentry kind="src" path="${resourceDirectory}" including="${include}" excluding="${exclude}" />
<classpathentry kind="src" path="${resourceDirectory}" including="${includingAsString}" excluding="${excludingAsString}" />
</j:if>
</j:forEach>
</j:if>
</j:if>
</j:if>
<!-- Add the list of additional directories for the classpath from ${maven.eclipse.classpath.include}-->
@@ -127,14 +138,25 @@
<j:if test="${pom.build.unitTest != null}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<!-- Turn off for most users this buggy code-->
<j:if test="${maven.eclipse.addResources == 'true'}">
<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)}">
<classpathentry kind="src" path="${resourceDirectory}" output="${testOutputDir}" />
<classpathentry kind="src" path="${resourceDirectory}" output="${testOutputDir}" including="${includingAsString}" excluding="${excludingAsString}"/>
</j:if>
</j:forEach>
</j:if>
</j:if>
</j:if>
</j:if>

View File

@@ -20,7 +20,7 @@
xmlns:u="jelly:util"
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-maven-eclipse-addResources">
</goal>
<goal name="test-init">
@@ -111,7 +111,7 @@
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@kind,'src')])"/>
<assert:assertEquals expected="6" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
<assert:assertEquals expected="4" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
</goal>
@@ -154,5 +154,21 @@
<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-maven-eclipse-addResources">
<attainGoal name="test-init"/>
<!-- Not working! ARgh-->
<j:set var="maven.eclipse.addResources" value="true"/>
<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(@kind,'src')])"/>
<assert:assertEquals expected="4" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
</goal>
</project>

View File

@@ -25,6 +25,8 @@
</properties>
<body>
<release version="1.9" date="in cvs">
<action dev="epugh" type="add">add property maven.eclipse.addResources=false to prevent the build resources from breaking old Eclipse builds.</action>
<action dev="epugh" type="add">Allow includes/excludes in build resources to be used in the classpath generation.</action>
<action dev="epugh" type="add" issue="MPECLIPSE-50" due-to="Simon Ringuette">Support for Eclipse-Plugin maven projects (or kind="con" classpath).</action>
<action dev="epugh" type="fix" issue="MPECLIPSE-49" due-to="Fabrizio Giustina">duplicate build path added if resouce directory is the same as java source dir.</action>
<action dev="epugh" type="fix" issue="MPECLIPSE-48" due-to="Fabrizio Giustina">Simple implementation of handling source artifacts.</action>