Category Archives: maven

Unix find and grep

Periodically I need to find some files within a unix server that contain some random text. I also get caught out between say Redhat or Solaris or OSX.

Recently it was searching for some text within a heap of maven pom files.

find . -name pom.xml | xargs grep '1.2-SNAPSHOT'

Maven Skip Tests

I keep forgetting this. So to skip the test cycle when executing maven:


Executing a class using the Maven Exec Plugin

Today, in a java maven built webapp, I needed to have a way to execute a class from the commandline. As maven was already building package into a war, I needed something extra.

Bring in the Maven Exec Plugin:

Pretty useful as I was able to define a specific profile for this class and now execute it by:

mvn compile -P run_my_class

Have a look at the documentation.

Also a good quick overview is provided by

Maven Webapps debug with Eclipse and Tomcat

I like using Maven. I also like using Step-Trace-Debugging. So here is what I do to accomplish this using Tomcat, Maven and Eclipse.



  • Create or Import your maven project into Eclipse
  • Select File > Properties for this project
  • Select the Tomcat property
  • Check the box “Is a Tomcat Project”
  • Enter the context name. For my example, dcmdb
  • Click Apply
  • Go to /conf/Catalina/localhost and edit the context file i.e. dcmdb.xml.
    • Edit the docBase and workDir to point to the location of your maven project
    • Notice that the docbase should point to ../dcmdb/target/dcmdb-1.0 where
      • ../dcmdb = the location of my maven project
      • ../target/ = the directory that is created when using the maven package command
      • ../dcmdcb-1.0 = the directory that is my artifact name. It’s the webapp
  • The final step involves changing the Java Build Path property in Eclipse by pointing the source output to /target/dcmdb-1.0/WEB-INF/classes. This means that once you make a change to your code all you need to do is restart tomcat.