You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Brett Porter <br...@apache.org> on 2006/05/15 01:15:20 UTC

Re: Modifing the contents of an artifact before install

This sounds like a really crappy way to have to run your tests. Can't 
MockStrutsTestCase look at an alternate location for the XML file?

Perhaps some functionality to add to Cactus since it does WAR 
modification for this purpose? :)

- Brett

Felipe Leme wrote:
> Hi all,
> 
> Is it posible to remove/replace a file from the generated M2 artifact 
> after the test phase (but before install)?
> 
> Let me try to explain my case to make it clear: I have a Struts-based 
> web application built with Maven 2 which depends on some DAO interfaces 
> defined in another project. During development, the DAO are implemented 
> by dummy classes (so the developers can implement the Struts classes 
> without depending on the database and these classes can be tested using 
> MockStrutsTestCase) but the installed/deployed war should depend on the 
> right classes (that are provided by another jar).  In other words, I 
> have 2 issues with this scenario:
> 
> 1.The bogus classes are always included in the war (I've even created an 
> issue for that http://jira.codehaus.org/browse/MWAR-29). I could create 
> a third project with only those classes, but besides not being an 
> elegant solution, it wouldn't solve my second issue;
> 2.There is a XML file that defines which class implement the DAO 
> interface; I need to replace that file in the final war. I've tried to 
> create different profiles for each scenario (i.e., development and 
> production, with each profile defining a different resources directory), 
> but it didn't work, as even in the production profile the bogus XML 
> should be used to test the Struts classes (I'm not interested on testing 
> the web application using the database; the database access is tested on 
> its own project and the real integration test is done by another 
> project, which deploys the war using cargo and tests it using HTTP Unit).
> 
> So, what I think would be an easy solution is to configure the POM (or 
> some plugin) to ' tune' my WAR after the test but before the install 
> lifecycle - is there a recommended/easy way of doing so (other than 
> having to implement my own plugin or write Ant tasks on the 
> test-integration-phase)?
> 
> Regards,
> 
> -- Felipe
> 
> PS: I'm finally using M2, but I'm still dozens of thousands of messages 
> late in the user/dev lists :-(
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org