Hilco,

I think we did something similar to what you are trying to do: i had
an an ant target that run a junit task, which is an optional task as
well.

I got that to work by adding a dependency on ant-junit in my POM file,
and calling out to the junit task within the same POM:
....
 <dependency>
           <groupId>ant</groupId>
           <artifactId>ant-junit</artifactId>
           <version>1.6.5</version>
           <scope>test</scope>
       </dependency>
   </dependencies>

   <build>
       <plugins>
           <plugin>
               <artifactId>maven-antrun-plugin</artifactId>
               <executions>
                   <execution>
                       <id>run-integration-tests</id>
                       <phase>integration-test</phase>
                       <configuration>
                           <tasks>
                               <property
name="integrationTestReportDir"
value="${project.build.directory}/integration-test-reports"/>
                               <taskdef name="junit"

classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
                                   <classpath>
                                       <path refid="maven.test.classpath"/>
                                   </classpath>
                               </taskdef>

                               <mkdir dir="${integrationTestReportDir}"/>

                               <junit printSummary="yes"
haltonerror="true" haltonfailure="true" fork="true" dir=".">
                                   <sysproperty key="basedir" value="."/>
                                   <formatter type="plain" usefile="true"/>
                                   <classpath>
                                       <path refid="maven.test.classpath"/>
                                   </classpath>
                                   <batchtest
todir="${integrationTestReportDir}">
                                       <fileset dir="src/test/java">
                                           <include name="**/*IT.java"/>
                                       </fileset>
                                   </batchtest>
                               </junit>

                           </tasks>
                       </configuration>
                       <goals>
                           <goal>run</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
...

hope this helps. you can find the entire source of the POM at
http://svn.marketcetera.org/platform/trunk/oms/pom.xml



On 7/21/06, Hilco Wijbenga <[EMAIL PROTECTED]> wrote:
Hi all,

I followed the "Developing Ant Plugins for Maven2.x" guide and ended
up with a nicely working hello-plugin. I would like to try more daring
things now. :-)

Instead of <echo>Hello world</echo> I'd like to execute
<echoproperties/>. This is part of the optional Ant tasks, however.
How do I include those?

The real object is to run XJC's Ant task. I know there are JAXB Maven2
plugins available but I'd like to know how to build a plugin myself.

It's working in Ant. Now I need to get it to run in Maven2. The
problem is creating the classpath for the XJC task. In my Ant
build.xml I have

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
  <classpath>
    <fileset dir="lib" includes="*.jar"/>
  </classpath>
</taskdef>

but that doesn't work in Maven2, of course.

I can include the various jars as dependencies (in the pom.xml for the
plugin, I assume) but how do I access them in xjc.build.xml? I guess I
could use something like ${user.home}/.m2/repository/... but that
doesn't strike me as the right way to go about things.

Please enlighten me.

Cheers,
Hilco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Toli Kuznets
http://www.marketcetera.org: Open-Source Trading Platform
download.run.trade.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to