I’ve been a user of Selenium testing for several years, though I noticed that some classes related to the HtmlUnit WebDriver were missing after upgrading from 2.52.0 to 2.53.0. After some research, I discovered that it is now a separate dependency allowing for a separate release cycle. Additionally, if you don’t use this (relatively generic) webdriver, you will no longer need to have it in your binaries.
Here’s all you need to do to add it to your Maven projects for testing.
In your pom.xml file:
I’ve migrated most of my projects to Maven, but occasionally have some developers that prefer to use Ant in their development environments. One problem that I used to have with Ant was that it required all dependencies to be checked into the SCM repository for each project. I recently found an Ant plugin that allows for it to read the Maven pom.xml and download the required dependencies, thus making projects MUCH easier to maintain! the steps are very simple.
Maven – pom.xml
- Make sure that you have your dependencies (nexus?) setup and tested here.
Maven – global settings.xml
- Make sure that your repositories are correctly configured.
Ant – build.xml (very minimal, I usually add as a step in existing scripts vs. using as standalone)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="example" basedir="." default="dependencies" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<taskdef uri="antlib:org.apache.maven.artifact.ant" classpath="ant/maven-ant-tasks-2.1.3.jar" />
<echo message="--- getting dependencies from maven pom.xml ---" />
<artifact:pom id="pom" file="pom.xml" /><!-- settingsFile="settings.xml" -->
<artifact:dependencies filesetId="test.dependencies" pomRefId="pom" useScope="test" />
<fileset refid="test.dependencies" />
<mapper type="flatten" />
- Make sure that you put the JAR (
maven-ant-tasks-2.1.3.jar) in the proper place…
If everything is working well, you can now purge most of the JAR’s that reside inside your web projects as the Ant build process can retrieve them based on values in the Maven pom.xml file.