Hi Petar,

Thanks for messaging me about this yesterday. I will give you a hand to get
this plugin working. I have been looking at how I did this previously,
because I had this all working on maven1. So I looked over what I did there
to help me remember how it is supposed to go. This was with the cactus
maven1 plugin version 1.7.2.

I am testing a resource adapter as a .rar file. However, this does not
impact too much how I use cactus, because I test it by exposing its
functionality through a session bean, and run my cactus tests through that
by extending ServletTestCase. The session bean and the servlet test case are
all in one maven1 project:

src/main/../MySessionBean.java
sec/cactus-test/../MyCactusTestCase.java

The .rar file is produced by a seperate project.

The steps to getting the test working in maven1 were:

ear:ear - produces a .ear file with the project depdency jars in it. No
servlets or session beans are compiled yet.
cactus:cactifyear - this does quite a lot! namely:
 invokes the ejb:ejb goal which:
   invokes java:compile and more - compiles MySessionBean.java into a .jar.
 invokes cactus:cactifywar - compiles MyCactusTestCase into a .war and does
its magic on it.
 adds the .war and the ejb .jar to the .ear and does its magic on it.

Then its start container, deploy .rar, deploy .ear, run cactus tests, shut
container down again. All from one maven1 project.

I notice that the way the maven2 plugins for cactus work is a little
different to this. I'm looking at the source code for CactifyEarMojo and at
http://jakarta.apache.org/cactus/integration/maven2/index.html for guidance.
It looks like there is some of the maven1 magic where the plugin is smart
enough to build the .war file but it does not invoke a ejb:ejb equivalent
goal. This is fine, I just think I may need to split the project  in two to
achieve what I want:

mytestejb:
src/main/../MySessionBean.java
builds a .jar containing this EJB.

mytestear:
sec/cactus-test/../MyCactusTestCase.java
invoke the .ear plugin to build a .ear file containing mytestejb.jar.
run cactus on this .ear? this will compile MyCactusTestCase.java into a .war
and ad it to the .ear along with cactification of the web.xml and
application.xml.

If I do it through the antrun plugin using the ant cactus tasks, I think I
will have to split my project into three:

mytestejb:
src/main/../MySessionBean.java
builds a .jar containing this EJB.

mytestservlet:
sec/cactus-test/../MyCactusTestCase.java
builds .war containing the cactus test case.

mytestear:
depends on mytestejb.jar and mytestservlet.war.
invoke the .ear plugin to build a .ear file containing mytestejb.jar.
run cactus on this .ear with mytestservlet.war as a <cactuswar> element in
this call. This add mytestservlet.war to the .ear and will cactify the
web.xml and application.xml.

I will try the antrun approach just now. If you get the m2 plugin working
let me know, and I will try it out using the plugin approach. That would be
shorter than having to create the .war myself. Thanks for your help.

Rupert

Reply via email to