-
1. Re: Production/Testing configuration?
ssilvert Mar 24, 2008 10:34 AM (in response to stephanos)How you solve this problem depends on your build process.
For the JSFUnit project, you can look at the "HelloJSF" example and see how we solve this for Maven. We have the main build of the WAR that is the "production version" called "HelloJSF Example App". It has no dependency on JSFUnit. Then we have another submodule that depends on the production version of the WAR called "HelloJSF JSFUnit Integration Test". This is where we put a dependency on JSFUnit and use a different copy of web.xml. The only problem with this approach is that you do need to maintain two versions of web.xml.
A possible way to avoid having two web.xml files is to have the same setup as above but use Maven's filtering capability to parameterize web.xml in the production version. Then you build web.xml on the fly depending on whether you are building the production version or the test version.
Note that Servlet 2.0 should make this problem disappear, because you will be able to split web.xml into pieces instead of having only one file.
For an Ant build, you could take the same kind of approach, but it's a little more work.
Stan -
2. Re: Production/Testing configuration?
kragoth Apr 3, 2008 3:44 AM (in response to stephanos)It is relatively simple with ant and possibly with mavern I'm not sure.
I just use an ant task that is called only when a particular property is set (or not set depends on what you prefer) but it's like this.<target name="create.jsfunit.exploded.dir" depends="compile.test" if="gekko.web.run.jsftests"> <property name="force.jsfunit.run" value="=${gekko.web.run.jsftests}"></property> <path id="jsfunit.classpath"> <fileset dir="${lib.dir}/jsf-unit"> <include name="**/*.jar"/> </fileset> <fileset dir="${gekko-shared.lib.test.dir}"> <include name="junit/*.jar"/> </fileset> <fileset dir="${gekko-shared.lib.prod.dir}"> <include name="aspectj/*.jar"/> </fileset> </path> <taskdef name="jsfunitwar" classname="org.jboss.jsfunit.ant.JSFUnitWarTask" classpathref="jsfunit.classpath"/> <jsfunitwar srcfile="${exploded.dir}" destfile="${exploded-jsfunit.dir}"> <classes dir="${classes.test}" includes="**/jsfunit/**/*.class"> </classes> <TestRunner/> </jsfunitwar> </target>
This way my prod code never has the jsfunit stuff in it including the filters!
Works really well