Monday, 5 December 2011

Using Verifier in Ant

When deploying the Enterprise JavaBeans, JBoss attempts to verify each bean against the specification to make sure the Bean Developer has fulfilled her contract to implement all the required interfaces. The verifier goes through both session and entity beans making sure the method descriptors do not violate the specification, RMI/IIOP requirements are met, the relevant parts of the deployment descriptor are correct, and so forth.

It is also possible to use the verifier as part of your build process. Using Ant to build your project enables you to verify your Enterprise JavaBeans as you compile them. This removes the extra step of deploying just to verify your ejb-jar file is compliant and deploys correctly in the container. In case of spec violations, you can optionally stop the build process and rework your files to meet the specification requirements. This Howto explains the setup you need to verify your beans early rather than late.

Getting the required files

To use the verifier in Ant you will need two jars copied from the JBoss distribution to your build directory: verifier.jar and metadata.jar. You will find the verifier.jar file in the/dist/bin directory of your JBoss installation, and the metadata.jar in the /dist/external directory.
If you are using the CVS version of JBoss, you can build both of the above mentioned files by executing
src/build> build verifier
in the /src/build directory. This will generate the required packages to the correct directories.

Edit build.xml

A custom verifier task for Ant does not exist at the moment but you can execute the verifier from Ant by creating a new JVM for it using Ant's built in <java> task. For the most up to date information of using the <java> tag, see Ant online documentation.
Below is an example of using the <java> tag to execute the verifier:
<!-- verify the EJBs -->
        <java classname = "org.jboss.verifier.Main" fork="true">
            <classpath refid = "classpath"/>
            <arg value = "${dist.home}/admin.jar"/>

No comments:

Post a Comment