BotDetect Java CAPTCHA Ant+Ivy Build Dependency

BotDetect Java Captcha dependency using Ivy and ANT build

This document describes how integrate BotDetect Java Captcha Library (available in our git.captcha.com repository) into an Ant project using Ivy.

BotDetect Java Captcha dependency in an Apache ANT Build is available here.

ivy-settings.xml -- Ivy configuration file

Ivy needs repository information configured (in ivy-setting.xml file) in order to download BotDetect Java Captcha Maven artifact:

<ivysettings>
  <properties file="build.properties" />
  <settings defaultResolver="default-chain"/>
  <resolvers>
    <chain name="default-chain">
      <ibiblio name="botdetect" root="https://git.captcha.com/botdetect-java-captcha.git/blob_plain/HEAD:" m2compatible="true"/>
      ...
    </chain>
  </resolvers>
</ivysettings>

ivy.xml -- file containing dependency descriptions

To complete BotDetect Java Captcha installation, we need to define dependency in ivy.xml file:

<ivy-module version="2.0">
  <info organisation="org.apache" module="WebProject" />

  <!-- Classpath management, thanks Maven -->
  <configurations>
    <conf name="compile" description="compile dependencies"/>
    <conf name="runtime" description="runtime dependencies" extends="compile"/>
    <conf name="test"    description="test dependencies" extends="runtime"/>
  </configurations>

  <dependencies>
    <dependency org="com.captcha" name="botdetect-jsf20" rev="4.0.beta3.7" conf="compile->default"/>
    ...
  </dependencies>
</ivy-module>

In case your application uses JSF 1.2 you will need to add botdetect-jsf12 instead of botdetect-jsf20.

Finally, we add target to your project's build.xml in order to get Dependencies.

<target name="resolve" description="retrieve dependencies with ivy">
  <echo message="Getting dependencies..." />
  <ivy:retrieve />
  <ivy:cachepath pathid="compile.path" conf="compile" />
  <ivy:cachepath pathid="runtime.path" conf="runtime" />
  <ivy:cachepath pathid="test.path" conf="test" />
</target>

ivy: retrieve retrieves all the dependencies of the last resolve call to a lib directory.

Configure BotDetect CaptchaServlet

Next, it is mandatory to configure BotDetect Captcha servlet by adding the following entry to your app's config (web.xml) file:

<servlet>
  <servlet-name>BotDetect Captcha</servlet-name>
  <servlet-class>com.captcha.botdetect.web.servlet.CaptchaServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>BotDetect Captcha</servlet-name>
  <url-pattern>/botdetectcaptcha</url-pattern>
</servlet-mapping>

And then integration starts to differ depending of what kind of web application you develop.

Adding BotDetect Java Captcha to JSP forms

Here is where you can find how to add BotDetect CAPTCHA Protection to JSP Forms.

Adding BotDetect Java Captcha to file JSF forms

Here is where you can find how to add BotDetect CAPTCHA Protection to JavaServer Faces Applications.

Adding BotDetect Java Captcha to Spring MVC Forms

Here is where you can find how to integrate BotDetect Java Captcha into Spring MVC Applications.

Adding BotDetect Java Captcha to Struts Forms

Here is where you can find how to integrate BotDetect Java Captcha into Struts Applications.


Please Note

BotDetect Java Captcha Library v4.0.Beta3.7 is an in-progress port of BotDetect 4 Captcha, and we need you to guide our efforts towards a polished product. Please let us know if you encounter any bugs, implementation issues, or a usage scenario you would like to discuss.