Maven 1.x Ant Plugin

pom.build.unitTest.resources.includes is illegal

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6, 1.7
  • Fix Version/s: 1.7
  • Component/s: None
  • Labels:
    None
  • Environment:
    any
  • Number of attachments :
    0

Description

build.jelly, line 246 (as of 27/04/2004 ) contains the
following code block:

<j:choose trim="true">
<j:when test="${!pom.build.unitTest.resources.includes.isEmpty()}">
<j:set var="maven.has.test.resource.patterns" value="true"/>
</j:when>
<j:when test="${!pom.build.unitTest.resources.excludes.isEmpty()}">
<j:set var="maven.has.test.resource.patterns" value="true"/>
</j:when>
</j:choose>

<j:if test="${maven.has.test.resource.patterns}">

<copy todir="$${testclassesdir}">
<fileset dir="${pom.build.unitTestSourceDirectory}">
<j:forEach var="res" items="${pom.build.unitTest.resources.includes}">
<include name="${res}"/>
</j:forEach>
<j:forEach var="res" items="${pom.build.unitTest.resources.excludes}">
<exclude name="${res}"/>
</j:forEach>
</fileset>
</copy>
</j:if>

According to the schema definition, there can not be a
build.unitTest.resources.includes
element. Actually, there is an intermediate <resource>
level.

The above mentioned block causes jelly exceptions in
(at least) rc2 and the current snapshots.
A symptom of this bug is that "maven dist" will fail
to build a source distribution".

A proper solution would be to add a nested iteration over
all <resources>/<resouce> elements. We have choosen to
<j:if>def the block pasted above, which gives as a working
"maven dist" too.

Issue Links

Activity

Hide
Arnaud Heritier added a comment -

Don't you think that your problem is the same as MPANT-12 ??
I corrected it Monday on CVS.

Show
Arnaud Heritier added a comment - Don't you think that your problem is the same as MPANT-12 ?? I corrected it Monday on CVS.
Hide
Matthias Kerkhoff added a comment -

This is issue is related to MPANT-12.
Sadly MPANT-12 is alread closed, and I do
not have the rights to reopen it due to not
being fixed.
Adding a simple <j:if...> does not help to
fix MPANT-12 and MPANT-13. Please study the
maven-project-3.xsd schema. The current code
only catches the cases without a a unitTest-
resources element. If one is present, the bug
will still appear! My bug report was filed
against the code base from 27/04/2004. Didn't
I mention it?

Show
Matthias Kerkhoff added a comment - This is issue is related to MPANT-12. Sadly MPANT-12 is alread closed, and I do not have the rights to reopen it due to not being fixed. Adding a simple <j:if...> does not help to fix MPANT-12 and MPANT-13. Please study the maven-project-3.xsd schema. The current code only catches the cases without a a unitTest- resources element. If one is present, the bug will still appear! My bug report was filed against the code base from 27/04/2004. Didn't I mention it?
Hide
Matthias Kerkhoff added a comment -

Actually, I notice that my cited code was taken
from the 1.6 version. The supposed fix does however
not work - I spent more time with it today than I
actually wanted to.

However - an easy test for the fix is to setup a
project.xml that contains the block:

<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>

<!-- unit test resources -->
<resources>
<resource>
<directory>${project_root_dir}</directory>
<targetPath>..</targetPath>
<includes>
<include>test/testdata/**</include>
</includes>
<excludes>
<exclude>test/testdata/placeholder.txt</exclude>
</excludes>
</resource>
</resources>
</unitTest>

which is just cut&paste from our project.xml. Project.xml's
like this will still fail. Just try it!

Please let me know if further information is needed.

Show
Matthias Kerkhoff added a comment - Actually, I notice that my cited code was taken from the 1.6 version. The supposed fix does however not work - I spent more time with it today than I actually wanted to. However - an easy test for the fix is to setup a project.xml that contains the block: <unitTest> <includes> <include>**/*Test.java</include> </includes> <!-- unit test resources --> <resources> <resource> <directory>${project_root_dir}</directory> <targetPath>..</targetPath> <includes> <include>test/testdata/**</include> </includes> <excludes> <exclude>test/testdata/placeholder.txt</exclude> </excludes> </resource> </resources> </unitTest> which is just cut&paste from our project.xml. Project.xml's like this will still fail. Just try it! Please let me know if further information is needed.
Hide
Arnaud Heritier added a comment -

Ok. Sorry Matthias I didn't saw the date. With your example I reproduce the problem. I'll see if I can resolve it.
Thks.

Show
Arnaud Heritier added a comment - Ok. Sorry Matthias I didn't saw the date. With your example I reproduce the problem. I'll see if I can resolve it. Thks.
Hide
Arnaud Heritier added a comment -

I commited a fix.
I tested it with your example and it's good.
Can you verify it ?
If it's good I'll close (definitively I hope) this issue.

Show
Arnaud Heritier added a comment - I commited a fix. I tested it with your example and it's good. Can you verify it ? If it's good I'll close (definitively I hope) this issue.
Hide
Matthias Kerkhoff added a comment -

Wow. Very fast. I'm impressed!
I've already tried the latest version and
it works for me.
There is - however - still one more issue
with the test resources. As it is not directly
related I'll create a new issue for it.

Show
Matthias Kerkhoff added a comment - Wow. Very fast. I'm impressed! I've already tried the latest version and it works for me. There is - however - still one more issue with the test resources. As it is not directly related I'll create a new issue for it.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: