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: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to