You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ma...@thewalrus.com on 2007/08/23 01:43:31 UTC

Missing ant task running under maven-antrun-plugin

I've found that when using the maven-antrun-plugin, there are certain 
ant tasks that are unknown and cannot be used.  I've looked for needed 
jars, but not found them.  I've looked for, but not found references to 
this problem.  Here is are a pom and ant file that illustrate the 
problem.  I would like to know how to fix this.  There are other tasks 
that do not work and several "builtin" properties that are undefined.  
I've just used <propertyfile> as an example.

Running "ant -f install.xml installTarget" succeeds and creates two 
files in the basedir.
Running "mvn install" fails
[ERROR] BUILD ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
C:\Temp\install.xml:26: Could not create task or type of type: propertyfile.

Ant could not find the task or a class this task relies upon.

I'm using maven 2.0.5 and ant ant 1.6.2.

Any help would be appreciated.
Thanks!
--the walrus

=====pom.xml=====
 <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.mycompany.mygroupid</groupId>
  <artifactId>myartifact</artifactId>
  <packaging>pom</packaging>
  <version>0.4.0-SNAPSHOT</version>
  <name>My maven and ant project</name>
 
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>installId</id>
            <phase>install</phase>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/install.xml" inheritRefs="true">
                  <target name="installTarget" />
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
         
        </executions>
      </plugin>

    </plugins>
  </build>
</project>
=================

=====install.xml=====
<?xml version="1.0"?>
<project name="myproject">

    <tstamp>
        <format property="install.date.time" pattern="yyyy.MM.dd.HH.mm"/>
        <format property="install.year" pattern="yyyy"/>
        <format property="install.month" pattern="MM"/>
        <format property="install.day" pattern="dd"/>
        <format property="install.hour" pattern="HH"/>
        <format property="install.minute" pattern="mm"/>
    </tstamp>

    <target name="installTarget">
        <echo message="Running installTarget"/>
       
        <!-- workaround -->
        <echo file="${basedir}/install_echo.properties"># my comment
install.date.time=${install.date.time}
install.year=${install.year}
install.month=${install.month}
install.day=${install.day}
install.hour=${install.hour}
install.minute=${install.minute}
</echo>
       
        <propertyfile file="${basedir}/install.properties">
            <entry key="install.date.time" value="${install.date.time}"/>
            <entry key="install.year" value="${install.year}"/>
            <entry key="install.month" value="${install.month}"/>
            <entry key="install.day" value="${install.day}"/>
            <entry key="install.hour" value="${install.hour}"/>
            <entry key="install.minute" value="${install.minute}"/>
        </propertyfile>
        <echo message="Finished installTarget"/>
    </target>
   
</project>
==========


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Missing ant task running under maven-antrun-plugin

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

The antrun-plugin by default only provides the core ant tasks. If you 
need additional tasks you need to include the jar containing the add-on 
tasks to the <dependencies/> section of the plugin definition in your pom.

<propertyfile> is an optional ant task and is contained in 
ant:ant-optional [1]. As you can see the newest version available in 
central is 1.5.3-1 whereas the current antrun-plugin uses ant-1.6.5. I 
don't know if the two versions are compatible. If not you either need to 
create an upload-request for ant-optional:1.6.5 or install it in your 
local repository.

-Tim

[1] http://repo1.maven.org/maven2/ant/ant-optional/

mavenmailinglists@thewalrus.com schrieb:
> I've found that when using the maven-antrun-plugin, there are certain 
> ant tasks that are unknown and cannot be used.  I've looked for needed 
> jars, but not found them.  I've looked for, but not found references to 
> this problem.  Here is are a pom and ant file that illustrate the 
> problem.  I would like to know how to fix this.  There are other tasks 
> that do not work and several "builtin" properties that are undefined.  
> I've just used <propertyfile> as an example.
> 
> Running "ant -f install.xml installTarget" succeeds and creates two 
> files in the basedir.
> Running "mvn install" fails
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Error executing ant tasks
> 
> Embedded error: The following error occurred while executing this line:
> C:\Temp\install.xml:26: Could not create task or type of type: 
> propertyfile.
> 
> Ant could not find the task or a class this task relies upon.
> 
> I'm using maven 2.0.5 and ant ant 1.6.2.
> 
> Any help would be appreciated.
> Thanks!
> --the walrus
> 
> =====pom.xml=====
> <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.mycompany.mygroupid</groupId>
>  <artifactId>myartifact</artifactId>
>  <packaging>pom</packaging>
>  <version>0.4.0-SNAPSHOT</version>
>  <name>My maven and ant project</name>
> 
>  <build>
>    <plugins>
>      <plugin>
>        <artifactId>maven-antrun-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>installId</id>
>            <phase>install</phase>
>            <configuration>
>              <tasks>
>                <ant antfile="${basedir}/install.xml" inheritRefs="true">
>                  <target name="installTarget" />
>                </ant>
>              </tasks>
>            </configuration>
>            <goals>
>              <goal>run</goal>
>            </goals>
>          </execution>
>                </executions>
>      </plugin>
> 
>    </plugins>
>  </build>
> </project>
> =================
> 
> =====install.xml=====
> <?xml version="1.0"?>
> <project name="myproject">
> 
>    <tstamp>
>        <format property="install.date.time" pattern="yyyy.MM.dd.HH.mm"/>
>        <format property="install.year" pattern="yyyy"/>
>        <format property="install.month" pattern="MM"/>
>        <format property="install.day" pattern="dd"/>
>        <format property="install.hour" pattern="HH"/>
>        <format property="install.minute" pattern="mm"/>
>    </tstamp>
> 
>    <target name="installTarget">
>        <echo message="Running installTarget"/>
>              <!-- workaround -->
>        <echo file="${basedir}/install_echo.properties"># my comment
> install.date.time=${install.date.time}
> install.year=${install.year}
> install.month=${install.month}
> install.day=${install.day}
> install.hour=${install.hour}
> install.minute=${install.minute}
> </echo>
>              <propertyfile file="${basedir}/install.properties">
>            <entry key="install.date.time" value="${install.date.time}"/>
>            <entry key="install.year" value="${install.year}"/>
>            <entry key="install.month" value="${install.month}"/>
>            <entry key="install.day" value="${install.day}"/>
>            <entry key="install.hour" value="${install.hour}"/>
>            <entry key="install.minute" value="${install.minute}"/>
>        </propertyfile>
>        <echo message="Finished installTarget"/>
>    </target>
>   </project>
> ==========
> 
> 
> ---------------------------------------------------------------------
> 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