Archive for September, 2008

Testing Struts Apps With Maven

Thursday, September 11th, 2008

While switching my configuration manager project from Maven 1 to Maven 2, I had to figure out how to add WEB-INF/web.xml located in src/main/webapp directory to the Maven test class path, so that MockStrutsTestCase would be able to access it. After a bit of digging on the net, and experimenting, I found an easy way of accomplishing it. Here is what needs to be added to your POM:
<plugins>
<
plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/main/webapp</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugin>

After I’ve added this fragment, all the tests I’ve ported passed! Hurray!


Good article on Building and Deploying with Maven 2

Wednesday, September 3rd, 2008

We are using Maven 2 as part of our build/deploy/dependency management tool. It is great in dependency management, code quality reporting, deploying to repositories, as well as having a very uncomplicated build script and not having to store our Idea or Eclipse project files (since we have them generated). The biggest problem we discovered so far, was that maven is not so well suited to deploy projects into different environments – development, qa, production.  So, if you are developing reusable components – go for Maven, it will make your builds so much easier. If you have to build a product and deploy it to different servers (dev, qa, int, prod and prod_bcp) – it might not be as easy. After a long search on how other people have struggled with this problem, I found a good article The Pain of migrating from Ant to Maven and even though it does not solve my problem, it describes very well the pain points I felt when I worked with Maven.