You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Lyons, Roy" <Ro...@cmegroup.com> on 2012/07/27 19:15:21 UTC
Using ant-contrib in ant based plugin development
Maven User List,
I waited in sending to this list until after I had exhausted my other resources, including google searching, documentation, and experimentation of my own.
As such, I hope that your collective minds can take on this challenge.
So here is the problem:
[INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [cme-packaging:cme-packaging {execution: default-cli}]
cmepackage:
[echo] We are in UNIX
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: package.build.xml [cmepackage]: Failed to execute.
Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'for'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
What is extremely interesting to me is the fact that it can use the task definition for
Here is my declaration in my pom:
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<!-- Add the Ant plugin tools -->
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
I also placed a dependency on ant-contrib in my pom's dependencies section.
my build xml has this in it... as you can see, I was experimenting with different methods of forcing it to find the items. I have nothing special in mojos xml. Perhaps that is where my issue is?
<project name="processPackages" default="cmepackage" basedir="." >
<!--
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="path/to/ant-contrib.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
-->
<taskdef resource="net/sf/antcontrib/antlib.xml" >
<classpath refid="maven.plugin.classpath" />
</taskdef>
<target name="cmepackage">
<osfamily property="os.family" />
<if>
<equals arg1="${os.family}" arg2="unix" />
<then>
I had the most luck so far with
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Using ant-contrib in ant based plugin development
Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
Excellent! That explains why I had so much trouble with the 'for' task. I will give this method a try with the xml instead. I very much appreciate your reply on this.
-----Original Message-----
From: Aurélien Girardeau [mailto:aurelien.girardeau@gmail.com]
Sent: Saturday, July 28, 2012 8:26 AM
To: Maven Users List; manfred@mosabuam.com
Subject: Re: Using ant-contrib in ant based plugin development
Hi Roy,
I use ant-contrib in a Ant-based Mojo and it works fine for me.
Here is my ant-contrib declaration in my build.xml:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant-contrib-jar}" />
</classpath>
</taskdef>
Note that antcontrib.properties doesn't contain "for" declaration. Prefer antlib.xml.
and here is my mojos.xml for ${ant-contrib-jar} parameter:
<parameter>
<name>ant-contrib-jar</name>
<property>ant-contrib-jar</property>
<required>true</required>
<expression>${ant-contrib-jar}</expression>
<defaultValue>${project.build.directory}/antcontrib/
ant-contrib-1.0b3.jar</defaultValue>
<type>java.lang.String</type>
<description></description>
</parameter>
Note that I don't use a antcontrib artifact deployed in my local repo, but a antcontrib jar installed in my ${project.build.directory}. I dont't think it change anything.
Did you try an echo on your ${settings.localRepository} or ${user.home} to check they are correcty loaded at Maven runtime?
Hope it can help,
Aurélien
2012/7/27 Manfred Moser <ma...@mosabuam.com>
> Why are you not implementing your plugin in Java or even Groovy?
>
>
> http://www.sonatype.com/books/mcookbook/reference/writing-plugins-alte
> rnative-sect-writing-groovy.html
>
> Shell script seems like a bad idea to me if you want it to run everywhere..
>
> manfred
>
> On Fri, July 27, 2012 2:26 pm, Lyons, Roy wrote:
> > Update:
> >
> > Not hearing anything made me give up on pure ant... I was able to
> > get things working with the <shellscript shell="ksh"> task, and just
> embedding
> > kornshell. That, of course, defeats the usual idea of a plugin
> > since it is platform specific... but later on, I can add in support
> > for windows
> by
> > doing a similar shellscript directive with cmd based on the osfamily
> task.
> > Interestingly, I was able to use both of those from ant-contrib... but
> > not <for or <if
> >
> > Odd.
> >
> >
> > I am still interested in possibilities of using ant in its pure
> > form, so any responses to this thread are still welcome.
> >
> > Thanks,
> >
> > Roy
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:16 PM
> > To: Maven Users List
> > Subject: RE: Using ant-contrib in ant based plugin development
> >
> > my webmail made me login again, and I didnt see part of my message
> > was missing. here is the full thing:
> >
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my
> > other resources, including google searching, documentation, and
> > experimentation of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > --------------------------------------------------------------------
> > ----
> > [ERROR] BUILD ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] Failed to execute: Executing Ant script:
> > package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual solutions are
> > to read the manual pages then download and install needed JAR files,
> > or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the
> > task definition for "osfamily", but not for the "for" task. Also of
> > interest to me is the fact that I can use this script with "ant -f"
> > without a problem.
> >
> > Before I get suggestions that I should use java instead, I need to
> confess
> > that I am only now just learning java. My job in configuration
> management
> > uses a whole lot more in perl and ksh than anything...
> >
> > Also, my research showed lots of ways to cope with it in antrun,
> > with an inline script -- but that won't do so much for me as I am
> > trying to make
> a
> > plugin...
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting
> > with different methods of forcing it to find the items. I have
> > nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" /> <taskdef
> > resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" /> </taskdef>
> > <target name="cmepackage"> <osfamily property="os.family" /> <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:15 PM
> > To: Maven Users List
> > Subject: Using ant-contrib in ant based plugin development
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my
> > other resources, including google searching, documentation, and
> > experimentation of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > --------------------------------------------------------------------
> > ----
> > [ERROR] BUILD ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] Failed to execute: Executing Ant script:
> > package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual solutions are
> > to read the manual pages then download and install needed JAR files,
> > or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the
> > task definition for
> >
> >
> >
> >
> >
> >
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting
> > with different methods of forcing it to find the items. I have
> > nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" /> <taskdef
> > resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" /> </taskdef>
> > <target name="cmepackage"> <osfamily property="os.family" /> <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Using ant-contrib in ant based plugin development
Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
I would like to report back that indeed the issue was with needing to use the xml instead. I had thought for sure that it was an issue with the classpath within maven, but I have a feeling that ant-contrib was already in my path when it came to running ant externally -- and this is why I saw a different behavior.
I am not sure if anyone on this list has write-access to the how-to on writing maven plugins with ant... but if there is, can you update the page to include a section on using ant-contrib functions and include this information to allow those who come after me to not have to bang their head for a few hours? The functions included in contrib would be very useful for moving official build scripts into a plugin method instead (which is what I plan to do here).
Thanks,
Roy
-----Original Message-----
From: Lyons, Roy
Sent: Monday, July 30, 2012 9:23 AM
To: Maven Users List
Subject: RE: Using ant-contrib in ant based plugin development
Excellent! That explains why I had so much trouble with the 'for' task. I will give this method a try with the xml instead. I very much appreciate your reply on this.
-----Original Message-----
From: Aurélien Girardeau [mailto:aurelien.girardeau@gmail.com]
Sent: Saturday, July 28, 2012 8:26 AM
To: Maven Users List; manfred@mosabuam.com
Subject: Re: Using ant-contrib in ant based plugin development
Hi Roy,
I use ant-contrib in a Ant-based Mojo and it works fine for me.
Here is my ant-contrib declaration in my build.xml:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant-contrib-jar}" />
</classpath>
</taskdef>
Note that antcontrib.properties doesn't contain "for" declaration. Prefer antlib.xml.
and here is my mojos.xml for ${ant-contrib-jar} parameter:
<parameter>
<name>ant-contrib-jar</name>
<property>ant-contrib-jar</property>
<required>true</required>
<expression>${ant-contrib-jar}</expression>
<defaultValue>${project.build.directory}/antcontrib/
ant-contrib-1.0b3.jar</defaultValue>
<type>java.lang.String</type>
<description></description>
</parameter>
Note that I don't use a antcontrib artifact deployed in my local repo, but a antcontrib jar installed in my ${project.build.directory}. I dont't think it change anything.
Did you try an echo on your ${settings.localRepository} or ${user.home} to check they are correcty loaded at Maven runtime?
Hope it can help,
Aurélien
2012/7/27 Manfred Moser <ma...@mosabuam.com>
> Why are you not implementing your plugin in Java or even Groovy?
>
>
> http://www.sonatype.com/books/mcookbook/reference/writing-plugins-alte
> rnative-sect-writing-groovy.html
>
> Shell script seems like a bad idea to me if you want it to run everywhere..
>
> manfred
>
> On Fri, July 27, 2012 2:26 pm, Lyons, Roy wrote:
> > Update:
> >
> > Not hearing anything made me give up on pure ant... I was able to
> > get things working with the <shellscript shell="ksh"> task, and just
> embedding
> > kornshell. That, of course, defeats the usual idea of a plugin
> > since it is platform specific... but later on, I can add in support
> > for windows
> by
> > doing a similar shellscript directive with cmd based on the osfamily
> task.
> > Interestingly, I was able to use both of those from ant-contrib... but
> > not <for or <if
> >
> > Odd.
> >
> >
> > I am still interested in possibilities of using ant in its pure
> > form, so any responses to this thread are still welcome.
> >
> > Thanks,
> >
> > Roy
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:16 PM
> > To: Maven Users List
> > Subject: RE: Using ant-contrib in ant based plugin development
> >
> > my webmail made me login again, and I didnt see part of my message
> > was missing. here is the full thing:
> >
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my
> > other resources, including google searching, documentation, and
> > experimentation of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > --------------------------------------------------------------------
> > ----
> > [ERROR] BUILD ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] Failed to execute: Executing Ant script:
> > package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual solutions are
> > to read the manual pages then download and install needed JAR files,
> > or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the
> > task definition for "osfamily", but not for the "for" task. Also of
> > interest to me is the fact that I can use this script with "ant -f"
> > without a problem.
> >
> > Before I get suggestions that I should use java instead, I need to
> confess
> > that I am only now just learning java. My job in configuration
> management
> > uses a whole lot more in perl and ksh than anything...
> >
> > Also, my research showed lots of ways to cope with it in antrun,
> > with an inline script -- but that won't do so much for me as I am
> > trying to make
> a
> > plugin...
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting
> > with different methods of forcing it to find the items. I have
> > nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" /> <taskdef
> > resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" /> </taskdef>
> > <target name="cmepackage"> <osfamily property="os.family" /> <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:15 PM
> > To: Maven Users List
> > Subject: Using ant-contrib in ant based plugin development
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my
> > other resources, including google searching, documentation, and
> > experimentation of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > --------------------------------------------------------------------
> > ----
> > [ERROR] BUILD ERROR
> > [INFO]
> > --------------------------------------------------------------------
> > ---- [INFO] Failed to execute: Executing Ant script:
> > package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual solutions are
> > to read the manual pages then download and install needed JAR files,
> > or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the
> > task definition for
> >
> >
> >
> >
> >
> >
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting
> > with different methods of forcing it to find the items. I have
> > nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" /> <taskdef
> > resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" /> </taskdef>
> > <target name="cmepackage"> <osfamily property="os.family" /> <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Using ant-contrib in ant based plugin development
Posted by Aurélien Girardeau <au...@gmail.com>.
Hi Roy,
I use ant-contrib in a Ant-based Mojo and it works fine for me.
Here is my ant-contrib declaration in my build.xml:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant-contrib-jar}" />
</classpath>
</taskdef>
Note that antcontrib.properties doesn't contain "for" declaration. Prefer
antlib.xml.
and here is my mojos.xml for ${ant-contrib-jar} parameter:
<parameter>
<name>ant-contrib-jar</name>
<property>ant-contrib-jar</property>
<required>true</required>
<expression>${ant-contrib-jar}</expression>
<defaultValue>${project.build.directory}/antcontrib/
ant-contrib-1.0b3.jar</defaultValue>
<type>java.lang.String</type>
<description></description>
</parameter>
Note that I don't use a antcontrib artifact deployed in my local repo, but
a antcontrib jar installed in my ${project.build.directory}. I dont't think
it change anything.
Did you try an echo on your ${settings.localRepository} or ${user.home}
to check they are correcty loaded at Maven runtime?
Hope it can help,
Aurélien
2012/7/27 Manfred Moser <ma...@mosabuam.com>
> Why are you not implementing your plugin in Java or even Groovy?
>
>
> http://www.sonatype.com/books/mcookbook/reference/writing-plugins-alternative-sect-writing-groovy.html
>
> Shell script seems like a bad idea to me if you want it to run everywhere..
>
> manfred
>
> On Fri, July 27, 2012 2:26 pm, Lyons, Roy wrote:
> > Update:
> >
> > Not hearing anything made me give up on pure ant... I was able to get
> > things working with the <shellscript shell="ksh"> task, and just
> embedding
> > kornshell. That, of course, defeats the usual idea of a plugin since it
> > is platform specific... but later on, I can add in support for windows
> by
> > doing a similar shellscript directive with cmd based on the osfamily
> task.
> > Interestingly, I was able to use both of those from ant-contrib... but
> > not <for or <if
> >
> > Odd.
> >
> >
> > I am still interested in possibilities of using ant in its pure form, so
> > any responses to this thread are still welcome.
> >
> > Thanks,
> >
> > Roy
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:16 PM
> > To: Maven Users List
> > Subject: RE: Using ant-contrib in ant based plugin development
> >
> > my webmail made me login again, and I didnt see part of my message was
> > missing. here is the full thing:
> >
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my other
> > resources, including google searching, documentation, and experimentation
> > of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Failed to execute: Executing Ant script: package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual
> > solutions are to read the manual pages then download and
> > install needed JAR files, or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the task
> > definition for "osfamily", but not for the "for" task. Also of interest
> > to me is the fact that I can use this script with "ant -f" without a
> > problem.
> >
> > Before I get suggestions that I should use java instead, I need to
> confess
> > that I am only now just learning java. My job in configuration
> management
> > uses a whole lot more in perl and ksh than anything...
> >
> > Also, my research showed lots of ways to cope with it in antrun, with an
> > inline script -- but that won't do so much for me as I am trying to make
> a
> > plugin...
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting with
> > different methods of forcing it to find the items. I have nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" />
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" />
> > </taskdef>
> > <target name="cmepackage">
> > <osfamily property="os.family" />
> > <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > ________________________________________
> > From: Lyons, Roy
> > Sent: Friday, July 27, 2012 12:15 PM
> > To: Maven Users List
> > Subject: Using ant-contrib in ant based plugin development
> >
> > Maven User List,
> >
> > I waited in sending to this list until after I had exhausted my other
> > resources, including google searching, documentation, and experimentation
> > of my own.
> >
> > As such, I hope that your collective minds can take on this challenge.
> >
> >
> > So here is the problem:
> >
> > [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> > (aggregator-style)
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
> >
> > cmepackage:
> > [echo] We are in UNIX
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Failed to execute: Executing Ant script: package.build.xml
> > [cmepackage]: Failed to execute.
> >
> > Could not create task or type of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual
> > solutions are to read the manual pages then download and
> > install needed JAR files, or fix the build file:
> > - You have misspelt 'for'.
> > Fix: check your spelling.
> > - The task needs an external JAR file to execute
> > and this is not found at the right place in the classpath.
> >
> >
> > What is extremely interesting to me is the fact that it can use the task
> > definition for
> >
> >
> >
> >
> >
> >
> >
> > Here is my declaration in my pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <artifactId>maven-plugin-plugin</artifactId>
> > <version>2.5</version>
> > <!-- Add the Ant plugin tools -->
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven.plugin-tools</groupId>
> > <artifactId>maven-plugin-tools-ant</artifactId>
> > <version>2.5</version>
> > </dependency>
> > <dependency>
> > <groupId>ant-contrib</groupId>
> > <artifactId>ant-contrib</artifactId>
> > <version>1.0b3</version>
> > </dependency>
> >
> >
> > I also placed a dependency on ant-contrib in my pom's dependencies
> > section.
> >
> > my build xml has this in it... as you can see, I was experimenting with
> > different methods of forcing it to find the items. I have nothing
> special
> > in mojos xml. Perhaps that is where my issue is?
> >
> > <project name="processPackages" default="cmepackage" basedir="." >
> > <!--
> > <taskdef uri="antlib:net.sf.antcontrib"
> > resource="net/sf/antcontrib/antlib.xml"
> > classpath="path/to/ant-contrib.jar"/>
> > <taskdef resource="net/sf/antcontrib/antlib.xml" />
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> > -->
> > <taskdef resource="net/sf/antcontrib/antlib.xml" >
> > <classpath refid="maven.plugin.classpath" />
> > </taskdef>
> > <target name="cmepackage">
> > <osfamily property="os.family" />
> > <if>
> > <equals arg1="${os.family}" arg2="unix" />
> > <then>
> >
> >
> > I had the most luck so far with
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> > <classpath>
> > <pathelement
> >
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> > />
> > </classpath>
> > </taskdef>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
RE: Using ant-contrib in ant based plugin development
Posted by Manfred Moser <ma...@mosabuam.com>.
Why are you not implementing your plugin in Java or even Groovy?
http://www.sonatype.com/books/mcookbook/reference/writing-plugins-alternative-sect-writing-groovy.html
Shell script seems like a bad idea to me if you want it to run everywhere..
manfred
On Fri, July 27, 2012 2:26 pm, Lyons, Roy wrote:
> Update:
>
> Not hearing anything made me give up on pure ant... I was able to get
> things working with the <shellscript shell="ksh"> task, and just embedding
> kornshell. That, of course, defeats the usual idea of a plugin since it
> is platform specific... but later on, I can add in support for windows by
> doing a similar shellscript directive with cmd based on the osfamily task.
> Interestingly, I was able to use both of those from ant-contrib... but
> not <for or <if
>
> Odd.
>
>
> I am still interested in possibilities of using ant in its pure form, so
> any responses to this thread are still welcome.
>
> Thanks,
>
> Roy
> ________________________________________
> From: Lyons, Roy
> Sent: Friday, July 27, 2012 12:16 PM
> To: Maven Users List
> Subject: RE: Using ant-contrib in ant based plugin development
>
> my webmail made me login again, and I didnt see part of my message was
> missing. here is the full thing:
>
>
> Maven User List,
>
> I waited in sending to this list until after I had exhausted my other
> resources, including google searching, documentation, and experimentation
> of my own.
>
> As such, I hope that your collective minds can take on this challenge.
>
>
> So here is the problem:
>
> [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> (aggregator-style)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
>
> cmepackage:
> [echo] We are in UNIX
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to execute: Executing Ant script: package.build.xml
> [cmepackage]: Failed to execute.
>
> Could not create task or type of type: for.
>
> Ant could not find the task or a class this task relies upon.
>
> This is common and has a number of causes; the usual
> solutions are to read the manual pages then download and
> install needed JAR files, or fix the build file:
> - You have misspelt 'for'.
> Fix: check your spelling.
> - The task needs an external JAR file to execute
> and this is not found at the right place in the classpath.
>
>
> What is extremely interesting to me is the fact that it can use the task
> definition for "osfamily", but not for the "for" task. Also of interest
> to me is the fact that I can use this script with "ant -f" without a
> problem.
>
> Before I get suggestions that I should use java instead, I need to confess
> that I am only now just learning java. My job in configuration management
> uses a whole lot more in perl and ksh than anything...
>
> Also, my research showed lots of ways to cope with it in antrun, with an
> inline script -- but that won't do so much for me as I am trying to make a
> plugin...
>
> Here is my declaration in my pom:
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-plugin-plugin</artifactId>
> <version>2.5</version>
> <!-- Add the Ant plugin tools -->
> <dependencies>
> <dependency>
> <groupId>org.apache.maven.plugin-tools</groupId>
> <artifactId>maven-plugin-tools-ant</artifactId>
> <version>2.5</version>
> </dependency>
> <dependency>
> <groupId>ant-contrib</groupId>
> <artifactId>ant-contrib</artifactId>
> <version>1.0b3</version>
> </dependency>
>
>
> I also placed a dependency on ant-contrib in my pom's dependencies
> section.
>
> my build xml has this in it... as you can see, I was experimenting with
> different methods of forcing it to find the items. I have nothing special
> in mojos xml. Perhaps that is where my issue is?
>
> <project name="processPackages" default="cmepackage" basedir="." >
> <!--
> <taskdef uri="antlib:net.sf.antcontrib"
> resource="net/sf/antcontrib/antlib.xml"
> classpath="path/to/ant-contrib.jar"/>
> <taskdef resource="net/sf/antcontrib/antlib.xml" />
> <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> <classpath>
> <pathelement
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> />
> </classpath>
> </taskdef>
> -->
> <taskdef resource="net/sf/antcontrib/antlib.xml" >
> <classpath refid="maven.plugin.classpath" />
> </taskdef>
> <target name="cmepackage">
> <osfamily property="os.family" />
> <if>
> <equals arg1="${os.family}" arg2="unix" />
> <then>
>
>
> I had the most luck so far with
> <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> <classpath>
> <pathelement
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> />
> </classpath>
> </taskdef>
>
> ________________________________________
> From: Lyons, Roy
> Sent: Friday, July 27, 2012 12:15 PM
> To: Maven Users List
> Subject: Using ant-contrib in ant based plugin development
>
> Maven User List,
>
> I waited in sending to this list until after I had exhausted my other
> resources, including google searching, documentation, and experimentation
> of my own.
>
> As such, I hope that your collective minds can take on this challenge.
>
>
> So here is the problem:
>
> [INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging]
> (aggregator-style)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [cme-packaging:cme-packaging {execution: default-cli}]
>
> cmepackage:
> [echo] We are in UNIX
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to execute: Executing Ant script: package.build.xml
> [cmepackage]: Failed to execute.
>
> Could not create task or type of type: for.
>
> Ant could not find the task or a class this task relies upon.
>
> This is common and has a number of causes; the usual
> solutions are to read the manual pages then download and
> install needed JAR files, or fix the build file:
> - You have misspelt 'for'.
> Fix: check your spelling.
> - The task needs an external JAR file to execute
> and this is not found at the right place in the classpath.
>
>
> What is extremely interesting to me is the fact that it can use the task
> definition for
>
>
>
>
>
>
>
> Here is my declaration in my pom:
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-plugin-plugin</artifactId>
> <version>2.5</version>
> <!-- Add the Ant plugin tools -->
> <dependencies>
> <dependency>
> <groupId>org.apache.maven.plugin-tools</groupId>
> <artifactId>maven-plugin-tools-ant</artifactId>
> <version>2.5</version>
> </dependency>
> <dependency>
> <groupId>ant-contrib</groupId>
> <artifactId>ant-contrib</artifactId>
> <version>1.0b3</version>
> </dependency>
>
>
> I also placed a dependency on ant-contrib in my pom's dependencies
> section.
>
> my build xml has this in it... as you can see, I was experimenting with
> different methods of forcing it to find the items. I have nothing special
> in mojos xml. Perhaps that is where my issue is?
>
> <project name="processPackages" default="cmepackage" basedir="." >
> <!--
> <taskdef uri="antlib:net.sf.antcontrib"
> resource="net/sf/antcontrib/antlib.xml"
> classpath="path/to/ant-contrib.jar"/>
> <taskdef resource="net/sf/antcontrib/antlib.xml" />
> <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> <classpath>
> <pathelement
> location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> />
> </classpath>
> </taskdef>
> -->
> <taskdef resource="net/sf/antcontrib/antlib.xml" >
> <classpath refid="maven.plugin.classpath" />
> </taskdef>
> <target name="cmepackage">
> <osfamily property="os.family" />
> <if>
> <equals arg1="${os.family}" arg2="unix" />
> <then>
>
>
> I had the most luck so far with
> <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
> <classpath>
> <pathelement
> location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"
> />
> </classpath>
> </taskdef>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Using ant-contrib in ant based plugin development
Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
Update:
Not hearing anything made me give up on pure ant... I was able to get things working with the <shellscript shell="ksh"> task, and just embedding kornshell. That, of course, defeats the usual idea of a plugin since it is platform specific... but later on, I can add in support for windows by doing a similar shellscript directive with cmd based on the osfamily task. Interestingly, I was able to use both of those from ant-contrib... but not <for or <if
Odd.
I am still interested in possibilities of using ant in its pure form, so any responses to this thread are still welcome.
Thanks,
Roy
________________________________________
From: Lyons, Roy
Sent: Friday, July 27, 2012 12:16 PM
To: Maven Users List
Subject: RE: Using ant-contrib in ant based plugin development
my webmail made me login again, and I didnt see part of my message was missing. here is the full thing:
Maven User List,
I waited in sending to this list until after I had exhausted my other resources, including google searching, documentation, and experimentation of my own.
As such, I hope that your collective minds can take on this challenge.
So here is the problem:
[INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [cme-packaging:cme-packaging {execution: default-cli}]
cmepackage:
[echo] We are in UNIX
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: package.build.xml [cmepackage]: Failed to execute.
Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'for'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
What is extremely interesting to me is the fact that it can use the task definition for "osfamily", but not for the "for" task. Also of interest to me is the fact that I can use this script with "ant -f" without a problem.
Before I get suggestions that I should use java instead, I need to confess that I am only now just learning java. My job in configuration management uses a whole lot more in perl and ksh than anything...
Also, my research showed lots of ways to cope with it in antrun, with an inline script -- but that won't do so much for me as I am trying to make a plugin...
Here is my declaration in my pom:
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<!-- Add the Ant plugin tools -->
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
I also placed a dependency on ant-contrib in my pom's dependencies section.
my build xml has this in it... as you can see, I was experimenting with different methods of forcing it to find the items. I have nothing special in mojos xml. Perhaps that is where my issue is?
<project name="processPackages" default="cmepackage" basedir="." >
<!--
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="path/to/ant-contrib.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
-->
<taskdef resource="net/sf/antcontrib/antlib.xml" >
<classpath refid="maven.plugin.classpath" />
</taskdef>
<target name="cmepackage">
<osfamily property="os.family" />
<if>
<equals arg1="${os.family}" arg2="unix" />
<then>
I had the most luck so far with
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
________________________________________
From: Lyons, Roy
Sent: Friday, July 27, 2012 12:15 PM
To: Maven Users List
Subject: Using ant-contrib in ant based plugin development
Maven User List,
I waited in sending to this list until after I had exhausted my other resources, including google searching, documentation, and experimentation of my own.
As such, I hope that your collective minds can take on this challenge.
So here is the problem:
[INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [cme-packaging:cme-packaging {execution: default-cli}]
cmepackage:
[echo] We are in UNIX
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: package.build.xml [cmepackage]: Failed to execute.
Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'for'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
What is extremely interesting to me is the fact that it can use the task definition for
Here is my declaration in my pom:
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<!-- Add the Ant plugin tools -->
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
I also placed a dependency on ant-contrib in my pom's dependencies section.
my build xml has this in it... as you can see, I was experimenting with different methods of forcing it to find the items. I have nothing special in mojos xml. Perhaps that is where my issue is?
<project name="processPackages" default="cmepackage" basedir="." >
<!--
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="path/to/ant-contrib.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
-->
<taskdef resource="net/sf/antcontrib/antlib.xml" >
<classpath refid="maven.plugin.classpath" />
</taskdef>
<target name="cmepackage">
<osfamily property="os.family" />
<if>
<equals arg1="${os.family}" arg2="unix" />
<then>
I had the most luck so far with
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Using ant-contrib in ant based plugin development
Posted by "Lyons, Roy" <Ro...@cmegroup.com>.
my webmail made me login again, and I didnt see part of my message was missing. here is the full thing:
Maven User List,
I waited in sending to this list until after I had exhausted my other resources, including google searching, documentation, and experimentation of my own.
As such, I hope that your collective minds can take on this challenge.
So here is the problem:
[INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [cme-packaging:cme-packaging {execution: default-cli}]
cmepackage:
[echo] We are in UNIX
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: package.build.xml [cmepackage]: Failed to execute.
Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'for'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
What is extremely interesting to me is the fact that it can use the task definition for "osfamily", but not for the "for" task. Also of interest to me is the fact that I can use this script with "ant -f" without a problem.
Before I get suggestions that I should use java instead, I need to confess that I am only now just learning java. My job in configuration management uses a whole lot more in perl and ksh than anything...
Also, my research showed lots of ways to cope with it in antrun, with an inline script -- but that won't do so much for me as I am trying to make a plugin...
Here is my declaration in my pom:
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<!-- Add the Ant plugin tools -->
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
I also placed a dependency on ant-contrib in my pom's dependencies section.
my build xml has this in it... as you can see, I was experimenting with different methods of forcing it to find the items. I have nothing special in mojos xml. Perhaps that is where my issue is?
<project name="processPackages" default="cmepackage" basedir="." >
<!--
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="path/to/ant-contrib.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
-->
<taskdef resource="net/sf/antcontrib/antlib.xml" >
<classpath refid="maven.plugin.classpath" />
</taskdef>
<target name="cmepackage">
<osfamily property="os.family" />
<if>
<equals arg1="${os.family}" arg2="unix" />
<then>
I had the most luck so far with
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
________________________________________
From: Lyons, Roy
Sent: Friday, July 27, 2012 12:15 PM
To: Maven Users List
Subject: Using ant-contrib in ant based plugin development
Maven User List,
I waited in sending to this list until after I had exhausted my other resources, including google searching, documentation, and experimentation of my own.
As such, I hope that your collective minds can take on this challenge.
So here is the problem:
[INFO] task-segment: [com.cme.plugins:cme-packaging:cme-packaging] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [cme-packaging:cme-packaging {execution: default-cli}]
cmepackage:
[echo] We are in UNIX
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to execute: Executing Ant script: package.build.xml [cmepackage]: Failed to execute.
Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'for'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
What is extremely interesting to me is the fact that it can use the task definition for
Here is my declaration in my pom:
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<!-- Add the Ant plugin tools -->
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
I also placed a dependency on ant-contrib in my pom's dependencies section.
my build xml has this in it... as you can see, I was experimenting with different methods of forcing it to find the items. I have nothing special in mojos xml. Perhaps that is where my issue is?
<project name="processPackages" default="cmepackage" basedir="." >
<!--
<taskdef uri="antlib:net.sf.antcontrib"
resource="net/sf/antcontrib/antlib.xml"
classpath="path/to/ant-contrib.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
-->
<taskdef resource="net/sf/antcontrib/antlib.xml" >
<classpath refid="maven.plugin.classpath" />
</taskdef>
<target name="cmepackage">
<osfamily property="os.family" />
<if>
<equals arg1="${os.family}" arg2="unix" />
<then>
I had the most luck so far with
<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
<classpath>
<pathelement location="${user.home}/.m2/repository/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org