Explains a temporary solution how to use the Testability Explorer in Maven 2 projects.
Testability Explorer is an open-source tool that identifies hard-to-test Java code. Right now, you can run the program from the Command Line or using the Ant Task. There is no Maven 2 plugin available at the moment. You have to use the
maven-antrun-plugin for the time being. However, there is one big problem. The Testability Explorer JAR files are not available yet in any Maven 2 repository. This page offers a temporary solution for this problem until the JAR files become available in any public Maven 2 repository.
Installing the JAR files to local Maven repo
In order to use the
maven-antrun-plugin with the
com.google.ant.TestabilityTask, you have to add two dependencies into your Maven 2 pom.xml under the dependencies section.
As said before, the JAR files are not available in any public repository. You have to add them manually into your local repository. Run the Maven install commands:
You are now ready to use the Testability Explorer in a Maven 2 powered project locally.
Running the Ant Task from Maven
Now that you have the JAR files available locally, you can use the
maven-antrun-plugin to run the Testability Explorer during builds. Go to the build section of your pom.xml and add the following plugin (if you do not have a build section in your pom.xml, you have to create
This will execute the
com.google.ant.TestabilityTask during the test phase of a Maven 2 run, ie. if you run
mvn test. Note: in the XML snippet above you have to replace
my.package with your own Java package that you want to have tested.
The suggested solution is far from optimal. As the JAR files will become available in a public Maven 2 repository, you will not have to copy them manually into you local repository. Sooner or later, there will also be am official Maven 2 plugin, so that the
maven-antrun-plugin will not be required anymore.