build failed when using maven call ant tasks "xslt" - maven-2

This part of the pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
<tasks>
<property name="generated.target" value="${basedir}/target/generated" />
<property name="generated.src.test" value="${generated.target}/src/main/java" />
<property name="generated.resources.test" value="${generated.target}/src/main/resources" />
<property name="generated.wsdl.test" value="${generated.resources.test}/" />
<property name="test.resources.dir" location="${basedir}/src/main/resources" />
<mkdir dir="${generated.resources.test}/wsdl/type_test" />
<xslt classpath="C://saxonhe9-3-0-5j/saxon9he.jar" style="${test.resources.dir}/wsdl/type_test/type_test_ID_xsd.xsl" in="${test.resources.dir}/wsdl/type_test/type_test.xsd" out="${generated.resources.test}/wsdl/type_test/type_test_1.xsd">
<param name="groupID" expression="1" />
</xslt>
...
This is the error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:
run (validate) on project cxf-testutils: An Ant BuildException has occured: java
.lang.NoClassDefFoundError: org/apache/xml/serializer/ExtendedContentHandler: or
g.apache.xml.serializer.ExtendedContentHandler -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-antrun-plugin:1.6:run (validate) on project cxf-te
stutils: An Ant BuildException has occured: java.lang.NoClassDefFoundError: org/
apache/xml/serializer/ExtendedContentHandler
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
I tried add classpath="C://saxonhe9-3-0-5j/saxon9he.jar" in the xslt tag.
But it still throws this exception. I tried Maven 2.2.0 and Maven 3.0.3.JDK 1.6.0 All failed.This pom is actually from apache cxf source code. Anyone can fix it?
UPDATE
I tried many workaround. But this one finally works.
Don't change anything in the xslt tag. Just put your xalan jar files into %JAVA-HOME%\jre\lib\endorsed. I download xalan-j_2_7_0. And run cmd
java org.apache.xalan.xslt.EnvironmentCheck to ensure it can find it. It finally works. Huh! It costs me hours to resolve it.

Use the XML Maven Plugin. This supports Saxon virtually out of the box.

Just ran into this issue,and this is what I did to resolve it.
Add dependency for saxon:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.4</version>
</dependency>
Add the classpath for saxon:
<xslt in="in.xml" out="out.html" style="style.xsl">
<classpath location="${net.sf.saxon:Saxon-HE:jar}" />
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>

Related

Cryptic jetty-maven-plugin error message 'ERROR: PWC6117: File "null" not found'

I have a Maven Webapp producing a WAR file.
I've just upgraded my Jetty plugin to the 7.4.2.v20110526 (from 6.x). I have the following set up:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.4.2.v20110526</version>
<executions>
<execution>
<id>jetty-run</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<connectors>
<connector implementation="${connector}">
<port>80</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<webAppConfig>
<contextPath>/foo</contextPath>
</webAppConfig>
<webappDirectory>${project.build.directory}/foo</webappDirectory>
<scanIntervalSeconds>10</scanIntervalSeconds>
<systemProperties>
<systemProperty>
<name>logback.configurationFile</name>
<value>file:${basedir}/target/${project.artifactId}-${project.version}/WEB-INF/classes/logback.xml</value>
</systemProperty>
</systemProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
</dependency>
</dependencies>
</plugin>
For some unclear to me reason, I keep getting the cryptic error message below:
2011-07-07 11:51:16.431:WARN::Aliased resource: file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp~=file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp
2011-07-07 11:51:16.507:WARN::Aliased resource: file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp~=file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp
ERROR: PWC6117: File "null" not found
There is no exception, however I cannot log in to the webapp.
However, if I grab the produced war file and deploy it into a clean Jetty installation, it works perfectly. What's the deal here...? I mean, this used to work with the 6.x plugin. No code changes whatsoever.
The contents of the exploded directory are exactly the same as the ones in the war file - I checked -- there are no missing files or any obvious differences.
This is a Spring Web project.
Any ideas? Has anybody seen this before?
Many thanks in advance!
Make sure your ModelAndView-s are mapped properly in your controller:
return new ModelAndView("WEB-INF/jsps/main");
In my case, above solution #tftd provided did not work so I commented out defaultHandler property, then error log disappeared.
<bean id="classNameControllerMappings"
class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="caseSensitive" value="true" />
<property name="order" value="2" />
<!--property name="defaultHandler">
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
</property-->
</bean>
Make sure you have imported org.springframework.web.servlet.ModelAndView. Once i had got this problem by importing org.springframework.web.portlet.ModelAndView.

How to use artifact:writepom and artifact:pom?

I've been trying to use writepom using this http://maven.apache.org/ant-tasks/examples/write-pom.html as a reference and have been having problems. I'm essentially just trying to test whether it will actually work so the POM file is quite bare. See below.
<project name="CreatePOMStructure" basedir="./test" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>
Test Script
</description>
<path id="maven-ant-tasks.classpath" path="/usr/local/apache-ant-1.8.1/lib/maven-ant-tasks-2.1.1.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<artifact:pom id="maven-pom" groupId="com.cgi.wealth" artifactId="maven-pom-setup" version="1.0" name="maven-setup">
<license name="apache" url="http://www.apache.org"/>
<dependency groupId="junit" artifactId="junit" version="4.1" scope="test"/>
<dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/>
</artifact:pom>
<artifact:writepom pomRefId="mypom1" file="mypom1.xml"/>
</project>
I get this error when I try to run ant
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-antrun-plugin:1.0:run
(compile) on project maven-setup:
Error executing ant tasks: The
following error occurred while
executing this line:
/maven-setup/scripts/build.xml:11:
java.lang.NoSuchMethodError:
org.apache.maven.settings.RuntimeInfo.(Lorg/apache/maven/settings/Settings;)V
-> [Help 1]
I'm not sure if it's relevant, but before I added the typedef I was getting this error:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-antrun-plugin:1.0:run
(compile) on project maven-setup:
Error executing ant tasks: The
following error occurred while
executing this
line:/maven-setup/scripts/build.xml:9:
Could not create task or type of type:
antlib:org.apache.maven.artifact.ant:pom.
Ant could not find the task or a class
this task relies upon.
Sorry for the most likely basic question, but I can't seem to fix this myself.
[EDIT]
Here's the pom.xml file which I use to run the ant build.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cgi.wealth</groupId>
<artifactId>maven-setup</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>compile</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/scripts/build.xml" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-ant-tasks</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</project>
The problem with the project only exists when running the maven task "mvn generate-sources" (see pom.xml above). When I just run "ant" it builds successfully. Any insight is greatly appreciated.
This script runs fine, provided you've put maven-ant-tasks-2.1.1.jar into the same directory where your build.xml lives.
The errors you are encountering tell me that the path may be incorrect.
Also, it's better not to set basedir attribute of your project and use a default ( current directory of the build.xml )
Last, but not least, artifact:writepom pomRefId should match the id of artifact:pom.
Below is the script:
<project
name="CreatePOMStructure"
default="default"
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
>
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.1.jar" />
<typedef
resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath"
/>
<target name="default">
<artifact:pom id="maven-pom"
groupId="com.cgi.wealth"
artifactId="maven-pom-setup"
version="1.0"
name="maven-setup"
>
<license name="apache" url="http://www.apache.org"/>
<dependency
groupId="junit"
artifactId="junit"
version="4.1"
scope="test"
/>
<dependency
groupId="org.codehaus.plexus"
artifactId="plexus-utils"
version="1.5.5"
/>
</artifact:pom>
<artifact:writepom pomRefId="maven-pom" file="mypom1.xml"/>
</target>
</project>

How to get hibernate3-maven-plugin hbm2ddl to find JDBC driver?

I have a Java project I am building with Maven. I am now trying to get the hibernate3-maven-plugin to run the hbm2ddl tool to generate a schema.sql file I can use to create the database schema from my annotated domain classes. This is a JPA application that uses Hibernate as the provider.
In my persistence.xml file I call out the mysql driver:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
When I run Maven, I see it processing all my classes, but when it goes to output the schema, I get the following error:
ERROR org.hibernate.connection.DriverManagerConnectionProvider - JDBC Driver class not found: com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
I have the MySQL driver as a dependency of this module. However it seems like the hbm2ddl tool cannot find it. I would have guessed that the Maven plugin would have known to search the local Maven file repository for this driver. What gives?
The relevant part of my pom.xml is this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<persistenceunit>my-unit</persistenceunit>
</componentProperties>
</configuration>
</plugin>
I figured it out. You have to add the corresponding JDBC driver as a dependency of the PLUGIN. Adding it as a dependency of the module does nothing. This seems surprising to me and kind of lame actually.
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<type>jar</type>
<version>5.0.8</version>
</dependency>
</dependencies>

How to execute tasks conditionally using the maven-antrun-plugin?

I need to execute some ant commands depending on an environment variable passed in as a parameter to the maven build command.
At the moment I have 3 tasks blocks and only the tasks block with no condition is being executed.
<tasks name="isProdCheck">
<condition property="isProd">
<equals arg1="${environment}" arg2="PROD" />
</condition>
</tasks>
<tasks if="isProd" depends="isProdCheck">
...
</tasks>
<tasks>
... I am the only block executed
</tasks>
What am I doing wrong, is there a better way to do this?
First, according to Maven 1.x website, the current stable release for maven 1.x is version 1.1, not 1.4. Second, there is no AntRun Plugin version 1.7 and, to my knowledge, this is a Maven 2 plugin. Third, the syntax you are using seems very similar to Using Attributes which, again, is about Maven 2.
So, I may be missing something but, this is very confusing and you should maybe clarify these points in your question.
Anyway, as you explicitly mentioned Maven 1, I'll try to answer. If I remember well, I would write a custom goal and use Jelly's core:if or core:when. To do so, provide something like this in maven.xml:
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
<goal name="my-goal">
<j:if test="${environment == 'PROD'}">
<ant:xxx .../>
</j:if>
</goal>
</project>
I'm really not sure of the syntax, all this Maven 1 stuff is just too far away, and I didn't test it (I'm too lazy to install Maven 1). But I guess you will. The scripting reference may help you.
To be honest, I really hope you have a good reason to prefer Maven 1.x over Maven 2.x :)
UPDATE: It appears that the OP is actually using Maven 2 so I'll update my question accordingly. To implement the desired behavior, you could use Ant-contrib's if task as shown below:
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="maven.plugin.classpath" />
<if>
<equals arg1="${foo}" arg2="bar" />
<then>
<echo message="The value of property foo is bar" />
</then>
<else>
<echo message="The value of property foo is not bar" />
</else>
</if>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
And then call mvn compile -Dfoo=bar (this is just an example).
But, all this is not the "maven way" to do things. Now that I understand a bit better what you are trying to do (but not entirely as you didn't explain your ultimate goal), I think that using build profiles would be more appropriate and, having read your own answer, I think that you are over complicating things (and that you are on the wrong path).
I understand that you are a Maven beginner but I'd suggest to try to use it though instead of falling back on Ant or you won't get the benefits of it. Also, when opening a question, instead of asking for a specific solution, you should rather explain your general problem, you'll get better answers. Here, I can't provide more guidance as I don't know what you are really trying to achieve.
You don't need to use AntContrib after maven-antrun-plugin 1.5 that uses <target> instead of <tasks> according to plugin usage. This tag works in the same way as , but in this one you can add conditions like the example below.
<properties>
<execute.my.target>true</execute.my.target>
</properties>
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>config</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<!-- this target will be executed always -->
<target>
<echo message="Hello there, I'm a simple target" />
</target>
<!--
This target will be executed if and only if
the property is set to true
-->
<target name="my-target" if="execute.my.target">
<echo message="Conditional target..." />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
</build>
The code above always executes the first target, but the second target depends on a property value. You can configure it for a parent and a sub-module project too, defining the plugin on <pluginsManagement> tag and calling some properties at the sub-modules, then calling the plugin.
Update:
Be sure to use the if parameter without ${}, since it can cause troubles mentioned in the comments section.
Resolved this issue by creating multiple named targets with "if" attributes and a condition property in a build.xml file in the project root as follows.
<target name="prod" if="isProd" depends="isProdCheck">
// do something
</target>
Passed properties of the command line switches I required, and called the ant targets in the build.xml file from the tasks section in the Maven POM as follows:
<tasks>
<ant antfile="${basedir}/build.xml">
<property name="environment" value="${environment}"/>
<target name="prod"/>
</ant>
</tasks>
runable example here https://www.surasint.com/run-ant-with-if-from-maven/
Another solution would be: keep the ant-contrib-1.0b3.jar to a path and then define it like this
<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${runningLocation}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
then
<target name="doSomething">
<if>
<equals arg1="${someProp}" arg2="YES" />
<then>
<echo message="It is YES" />
</then>
<else>
<echo message="It is not YES" />
</else>
</if>
</target>
I put full code example here which you can download https://www.surasint.com/2017/04/09/run-ant-with-if-from-maven/

Using Maven from Ant

Are there ant plugins that wrap maven so that I can make use of its dependency management features to download jars for me and place them in my ant build's lib folder?
My specific problem is that I'm using the Crap4j plugin for Hudson, but it doesn't, as of yet, support Maven. Since it's a small project, maven is overkill, but I don't want to go without mvn dependency:copy-dependcies if I don't have to.
Any suggestions? (other than suck it up)
There is a new set of Ant tasks that use Mercury. Mercury is the refactored code that will be the basis of way that Maven 3 interacts with Maven (and OSGi) repositories that is being implemented by Oleg Gusakov. Mercury is well tested, and you can start using it in Ant projects today. Take a look at some of the How-to documents that Oleg has written:
http://people.apache.org/~ogusakov/sites/mercury-ant/mercury-ant-tasks/howto.html
Here's a simple example of using Mercury in an Ant build.xml file. The following build file creates a classpath that depends on verion 3.0 of the asm artifact:
<javac srcdir="src/main/java"
destdir="target/classes">
<classpath>
<deps>
<dependency name="asm:asm:3.0"/>
</deps>
</classpath>
</javac>
There are a lot of advanced features such as support for verifying PGP signatures or MD5 digests. You can also start to define different repositories that Mercury depends on. This XML allows you to define a reference to a repository such as Nexus in addition to using a local directory as a repository:
<repo id="myCentral"
url="http://localhost:8081/nexus/contengs/groups/public"/>
<repository dir="/my/local/repo"/>
<javac srcdir="src/main/java"
destdir="target/classes">
<classpath>
<deps>
<dependency name="asm:asm:3.0"/>
</deps>
</classpath>
</javac>
If you need to reference a repository that requires authentication Mercury has support for storing a username and password:
<repo id="myCentral"
url="http://localhost:8081/nexus/contengs/groups/public">
<auth name="foo" pass="bar"/>
</repo>
<javac srcdir="src/main/java"
destdir="target/classes">
<classpath>
<deps>
<dependency name="asm:asm:3.0"/>
</deps>
</classpath>
</javac>
Most compelling is the ability to publish an artifact to a repository from an Ant build file. If you work in an organization of any scale, you'll want to start thinking about deploying artifacts to a repository manager like Nexus. With Mercury, you can start deploying artifacts to a repository manager without having to adopt Maven. Here's a build file that defines an authenticated repository and writes an artifact:
<repo id="myCentral"
url="http://localhost:8081/nexus/contengs/groups/public">
<auth name="foo" pass="bar"/>
</repo>
<write repoid="myCentral"
name="t:t:1.0"
file="${basedir}/target/t.jar"/>
Mercury is ready to use, and you can expect a lot of developments from Oleg going forward. If you want to start using it, the best place to look is at Oleg's How-to Page. (Note: This information will soon be integrated into the Definitive Guide)
Whilst the mercury tasks work, I haven't used them. I have had good success with their predecessors, the maven-ant-tasks. They're fairly simple to get going, if you already have a POM handy.
<project name="blah" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- If you drop the maven-ant-tasks in ~/.ant/lib, you don't need these two bits. -->
<taskdef uri="antlib:org.apache.maven.artifact.ant"
resource="org/apache/maven/artifact/ant/antlib.xml"
classpathref="ant.classpath" />
<path id="ant.classpath">
<fileset dir="${ant.tasks.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="resolve" description="--> retrieve dependencies with maven">
<!-- Resolve dependencies -->
<artifact:dependencies filesetId="dependency.fileset">
<pom file="pom.xml" />
</artifact:dependencies>
<!-- Copy all dependencies to the correct location. -->
<copy todir="${web.dir}/WEB-INF/lib">
<fileset refid="dependency.fileset" />
<!-- This mapper strips off all leading directory information -->
<mapper type="flatten" />
</copy>
</target>
</project>
I like to keep my ant task jars inside the project, so I've added the taskdef and path. But if you want to put maven-ant-tasks-2.0.9.jar in ~/.ant/lib, then you don't need to declare this stuff. I think.
If you think that Maven is overkill in your project, you could/should try Apache Ivy: It's a very powerful dependency management library similar to the Maven one.
If you're hosting a project on the web, take also a look at Ivy Roundup, it's a repository of Ivy definitions for various libraries.
Just use the Maven Ant Tasks. They can be downloaded at the normal maven download page.
Refer this: Why you should use the Maven Ant Tasks instead of Maven or Ivy
I wouldn't really recommend Ivy for reasons given in the link above.
It is very simple to run Maven goal from Ant
<target name="buildProject" description="Builds the individual project">
<exec dir="${source.dir}\${projectName}" executable="cmd">
<arg value="/c"/>
<arg value="${env.MAVEN_HOME}\bin\mvn.bat"/>
<arg line="clean install" />
</exec>
</target>
Using this you are allow to run any kind of Maven goal from Ant...
Enjoy....
In my case i just want an ejb jar to be at the repository so i could use it on another project with maven as dependency so:
<target name="runMaven" depends="deploy" description="LLama al maven.">
<exec executable="cmd">
<arg value="/c"/>
<arg value="mvn.bat install:install-file -DgroupId=com.advance.fisa.prototipo.camel -DartifactId=batch-process -Dversion=1.0 -Dpackaging=jar -Dfile=${jarDirectory}\batch-process.jar"/>
</exec>
</target>
Download Maven Ant Tasks then use this:
<target name="getDependencies">
<path id="maven-ant-tasks.classpath" path="${basedir}${file.separator}maven${file.separator}lib${file.separator}maven-ant-tasks.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
<artifact:dependencies filesetId="dependency.fileset" type="jar">
<pom file="pom.xml" />
</artifact:dependencies>
<!--TODO take care of existing duplicates in the case of changed/upgraded dependencies-->
<copy todir="lib">
<fileset refid="dependency.fileset" />
<mapper type="flatten" from="${dependency.versions}" />
</copy>
</target>
I am working on the same problem right now. I installed all necessary libs in my local Maven repo and from there I put it into our Company Maven Repo.
It is not working quite right yet. Some of the tests fail that work nicely in my Maven test run, but since the outcome of the test is not important for the coverage data, I am quite satisfied.
Here is my Maven snippet. I hope that helps.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<inherited>false</inherited>
<executions>
<execution>
<phase>site</phase>
<configuration>
<tasks>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<property name="CRAP4J_HOME" value="${user.home}/Projects/crap4j"/>
<taskdef name="crap4j" classname="org.crap4j.anttask.Crap4jAntTask">
<classpath>
<fileset dir="${CRAP4J_HOME}/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</taskdef>
<crap4j projectdir="${project.basedir}/alm-jar-server"
outputDir="${project.basedir}/crap4jReports"
dontTest="false"
debug="true">
<classes>
<pathElement location="${project.basedir}/target/classes"/>
</classes>
<srces>
<pathElement location="${project.basedir}/src/main/java"/>
</srces>
<testClasses>
<pathElement location="${project.basedir}/target/test-classes"/>
</testClasses>
<libClasspath>
<fileset dir="${user.home}/.m2/repository">
<include name="**/*.jar"/>
</fileset>
</libClasspath>
</crap4j>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.crap4j</groupId>
<artifactId>crap4j</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>args4j</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.agitar</groupId>
<artifactId>asmlib</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>com.agitar</groupId>
<artifactId>coverage</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>