Issue Details (XML | Word | Printable)

Key: CACTUS-132
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Felipe Leme
Reporter: Nicolas Chalumeau
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Cactus

Allow cactus plugin to include some resources

Created: 20/Jul/04 12:18 PM   Updated: 03/Nov/04 04:19 AM
Return to search
Component/s: Maven Integration
Affects Version/s: None
Fix Version/s: 1.7

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works CACTUS-132-felipeal.patch 2004-10-24 09:27 PM Felipe Leme 11 kB
File Licensed for inclusion in ASF works CACTUS-132-felipeal.patch2 2004-10-27 01:20 AM Felipe Leme 12 kB
Text File Licensed for inclusion in ASF works CACTUS-132-nchalumeau.patch 2004-10-27 09:06 PM Nicolas Chalumeau 8 kB
File Licensed for inclusion in ASF works changes.xml.diff 2004-07-28 05:26 PM Nicolas Chalumeau 1 kB
File Licensed for inclusion in ASF works plugin.jelly.diff 2004-07-20 06:32 PM Nicolas Chalumeau 0.9 kB
File Licensed for inclusion in ASF works plugin.properties.diff 2004-07-28 05:27 PM Nicolas Chalumeau 0.6 kB
File Licensed for inclusion in ASF works project.xml.diff 2004-07-28 05:27 PM Nicolas Chalumeau 0.8 kB
File Licensed for inclusion in ASF works properties.xml.diff 2004-07-28 05:29 PM Nicolas Chalumeau 0.8 kB
Zip Archive Licensed for inclusion in ASF works test06.zip 2004-10-27 09:21 PM Nicolas Chalumeau 7 kB
Zip Archive Licensed for inclusion in ASF works webjar.zip 2004-07-28 03:32 PM Nicolas Chalumeau 6 kB

Resolution Date: 03/Nov/04 04:19 AM


 Description  « Hide
In a project I produce a jar artifact. I have a webapp in my src/test/webapp directory. I need to include some resources in the war for the cactus test as junit does.

As Vincent answers me :
> Is there a way to include build resources and test resources in the
> webapp during a cactus test ?

... I guess the Cactus
plugin could copy some resources. However, the resources that Cactus would
copy (during the cactifywar step) would need to be defined as properties
(and not in the POM as there's not way currently to extend the POM and I
think we shouldn't reuse the junit resources which are for pure JUnit
tests).


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicolas Chalumeau added a comment - 20/Jul/04 06:32 PM
Add a patch.

Vincent Massol added a comment - 27/Jul/04 06:40 PM
Cool. Thanks Nicolas. Could you please also add the associated changes for properties.xml, changes.xml and plugin.properties? (and also mabye for project.xml to add you as a contributor :-))?

Nicolas Chalumeau added a comment - 28/Jul/04 03:32 PM
Here is a sample application that use strutstestcase. This example shows how to test a jar who contains struts action and need some file in the webapp classpath.

I will attach other files toonight

Nicolas Chalumeau added a comment - 28/Jul/04 05:36 PM
done.
The changes.xml patch fix a </action> without opening tag <action>

Felipe Leme added a comment - 19/Oct/04 11:57 AM
I will apply the changes.

Felipe Leme added a comment - 24/Oct/04 09:27 PM
Here is a condensed patch with all the changes, plus a test case and additional check if the directory exists.
I haven't commit it though, for a reason: once this new properties gets through, users will expect a mechanismo to include/exclude files, probably using wildcards (like * and **). So, I change the property to cactus.resources.dirs, in a way that would allow us to add new properties in the future (like cactus.resources.includes and cactus.resources.excludes). Note that this is not as straightfoward as having this info in the POM, as we cannot have individual includes/excludes for each directory.

Anyway, I will commit (or not) the changes once I get some feedback on this comment.

-- Felipe

PS: another improvement that could be made would be not relying on maven.build.dest and including the resources directly from inside the <cactifywar> tag. But I'm not sure if that would work (besides I haven't the spare cycles to check it right now :-)

Felipe Leme added a comment - 27/Oct/04 01:20 AM
Polished some documentation and updated with CVS (because of CACTUS-132 fix).

Nicolas Chalumeau added a comment - 27/Oct/04 09:06 PM
Add the global patch.
The following properties are add :
# (optional). List of resources label to include in the war classpath
cactus.resources.dirs=

# (optional). Label directory to include in the war classpath
#cactus.resources.X.dir=src/main/resources

# (optional). Regular expression for the label X that file have to match to be include in the war classpath. by default **/*
#cactus.resources.X.includes=**.xml,**.dtd

# (optional). Regular expression for the label X that file have to match to be exclude in the war classpath. by default none
#cactus.resources.X.excludes=

The includes/excludes regexp work and allow "recursive" includes by default.

test follow

Nicolas Chalumeau added a comment - 27/Oct/04 09:21 PM
I can't include this in the global patch so this is the zip of the test case.

I find something strange :
- when i am in the test06 dir and i launch cactus:test, the test are okay
- but when i am in maven dir and launch plugin:test, the test fail

In fact i see this before. The reactor seem to use for relative path it use as base path maven. ie :
When the copy of resource it looks for .../integration/maven/target/classes/test.properties and not for .../integration/maven/src/plugin-test/test06/target/classes/test.properties for the target dir

That's why plugin:test fail. Can't the pluginTest use the maven:maven tag could solve it ?

Nicolas,

Felipe Leme added a comment - 03/Nov/04 04:19 AM
Applied patch with minor documentation changes.