Maven using ANT plugin for SCP task : Embedded error: Could not create task or type of type: scp.

Discussion in 'Java' started by krabhi, Jul 25, 2006.

  1. krabhi

    krabhi Guest

    Hi,

    My requirement is automating the build process which contains execution
    of some shell scripts and file copy btw remote servers. And this is my
    first encounter with Maven and ANT. I am getting pear help in ANT,
    minimal in Maven 1.0.2 and NONE in MAVEN 2.0.4.

    MAVEN version: 2.0.4

    For script execution I am using ANT task exec via ANTRUN plugin for
    Maven.
    Similarly I plan to use ANT task scp via ANTRUN plugin for Maven.

    I have downloaded the jar "jsch-0.1.24.jar" via dependencies. Even
    added the path of this jar to the CLASSPATH.

    Script executed is command.bat which takes one arg and echo the same
    out.

    On execution, ERROR received is :
    *******************************************************************************************************
    Embedded error: Could not create task or type of type: scp.
    Ant could not find the task or a class this task relies upon.
    *******************************************************************************************************

    Please help me understand how can I get the scp task run.

    If this is not possible via ANTRUN plugin for MAVEN.
    Please help me understand which maven plugin can be employed for remote
    file transfer and how to do it.


    Regards,
    Kumar Abhinav



    *******************************************************************************************************
    Command executed: mvn install
    *******************************************************************************************************
    My 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.kaiser.build</groupId>
    <artifactId>run-script</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Maven Quick Start Archetype</name>
    <url>http://maven.apache.org</url>
    <dependencies>
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <!--scope>test</scope-->
    </dependency>
    <dependency>
    <groupId>jsch</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.14</version>
    <!--scope>test</scope-->
    </dependency>
    <dependency>
    <groupId>commons-net</groupId>
    <artifactId>commons-net</artifactId>
    <version>1.2.2</version>
    <!--scope>test</scope-->
    </dependency>
    </dependencies>
    <build>
    <plugins>
    <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
    <execution>
    <id>install</id>
    <phase>install</phase>
    <goals>
    <goal>run</goal>
    </goals>
    <configuration>
    <tasks>
    <exec dir="C:\Maven\run-script"
    executable="command.bat" os="Windows XP">
    <arg value="set1-1"/>
    </exec>
    <exec dir="C:\Maven\run-script"
    executable="command.bat" os="Windows XP">
    <arg value="set1-2"/>
    </exec>
    <exec dir="C:\Maven\run-script" executable="command.bat" os="Windows
    XP">
    <arg value="set1-3"/>
    </exec>
    <scp file="command.bat" todir="wasadm@172.17.136.28:/apps/WebSphere"
    password="wasadm"/>
    </tasks>
    </configuration>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
    </project>

    *******************************************************************************************************
    Log printed on the console
    *******************************************************************************************************

    C:\Maven\run-script>mvn install
    [INFO] Scanning for projects...
    [INFO]
    -------------------------------------------------------------------------
    ---
    [INFO] Building Maven Quick Start Archetype
    [INFO] task-segment: [install]
    [INFO]
    -------------------------------------------------------------------------
    ---
    [INFO] [resources:resources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:compile]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [resources:testResources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:testCompile]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [surefire:test]
    [INFO] Surefire report directory:
    C:\Maven\run-script\target\surefire-reports

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running com.kaiser.build.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032
    sec

    Results :
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

    [INFO] [jar:jar]
    [INFO] Building jar:
    C:\Maven\run-script\target\run-script-1.0-SNAPSHOT.jar
    [INFO] [install:install]
    [INFO] Installing
    C:\Maven\run-script\target\run-script-1.0-SNAPSHOT.jar to C:\D
    ocuments and
    Settings\kumar\.m2\repository\com\kaiser\build\run-script\1.0-SNAPS
    HOT\run-script-1.0-SNAPSHOT.jar
    [INFO] [antrun:run {execution: install}]
    [INFO] Executing tasks
    [exec] set1-1
    [exec] set1-2
    [exec] set1-3
    [INFO]
    ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Error executing ant tasks

    Embedded error: Could not create task or type of type: scp.

    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 'scp'.
    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.
    Fix: check the documentation for dependencies.
    Fix: declare the task.
    - The task is an Ant optional task and the JAR file and/or libraries
    implementing the functionality were not found at the time you
    yourself built your installation of Ant from the Ant sources.
    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to
    the
    task and make sure it contains more than merely a
    META-INF/MANIFEST.MF.
    If all it contains is the manifest, then rebuild Ant with the
    needed
    libraries present in ${ant.home}/lib/optional/ , or alternatively,
    download a pre-built release version from apache.org
    - The build file was written for a later version of Ant
    Fix: upgrade to at least the latest release version of Ant
    - The task is not an Ant core or optional task
    and needs to be declared using <taskdef>.
    - You are attempting to use a task defined using
    <presetdef> or <macrodef> but have spelt wrong or not
    defined it at the point of use

    Remember that for JAR files to be visible to Ant tasks implemented
    in ANT_HOME/lib, the files must be in the same directory or on the
    classpath

    Please neither file bug reports on this problem, nor email the
    Ant mailing lists, until all of these causes have been explored,
    as this is not an Ant bug.
    [INFO]
    ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO]
    ------------------------------------------------------------------------
    [INFO] Total time: 2 seconds
    [INFO] Finished at: Tue Jul 25 17:09:14 IST 2006
    [INFO] Final Memory: 5M/9M
    [INFO]
    ------------------------------------------------------------------------

    C:\Maven\run-script>
    *******************************************************************************************************
    krabhi, Jul 25, 2006
    #1
    1. Advertising

  2. krabhi ha scritto:

    > Hi,
    >
    > My requirement is automating the build process which contains execution
    > of some shell scripts and file copy btw remote servers. And this is my
    > first encounter with Maven and ANT. I am getting pear help in ANT,
    > minimal in Maven 1.0.2 and NONE in MAVEN 2.0.4.
    >
    > MAVEN version: 2.0.4
    >
    > For script execution I am using ANT task exec via ANTRUN plugin for
    > Maven.
    > Similarly I plan to use ANT task scp via ANTRUN plugin for Maven.
    >
    > I have downloaded the jar "jsch-0.1.24.jar" via dependencies. Even
    > added the path of this jar to the CLASSPATH.
    >
    > Script executed is command.bat which takes one arg and echo the same
    > out.
    >
    > On execution, ERROR received is :
    > *******************************************************************************************************
    > Embedded error: Could not create task or type of type: scp.
    > Ant could not find the task or a class this task relies upon.
    > *******************************************************************************************************
    >
    > Please help me understand how can I get the scp task run.
    >
    > If this is not possible via ANTRUN plugin for MAVEN.
    > Please help me understand which maven plugin can be employed for remote
    > file transfer and how to do it.
    >
    >
    > Regards,
    > Kumar Abhinav
    >
    >
    >
    > *******************************************************************************************************
    > Command executed: mvn install
    > *******************************************************************************************************
    > My 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.kaiser.build</groupId>
    > <artifactId>run-script</artifactId>
    > <packaging>jar</packaging>
    > <version>1.0-SNAPSHOT</version>
    > <name>Maven Quick Start Archetype</name>
    > <url>http://maven.apache.org</url>
    > <dependencies>
    > <dependency>
    > <groupId>junit</groupId>
    > <artifactId>junit</artifactId>
    > <version>3.8.1</version>
    > <!--scope>test</scope-->
    > </dependency>
    > <dependency>
    > <groupId>jsch</groupId>
    > <artifactId>jsch</artifactId>
    > <version>0.1.14</version>
    > <!--scope>test</scope-->
    > </dependency>
    > <dependency>
    > <groupId>commons-net</groupId>
    > <artifactId>commons-net</artifactId>
    > <version>1.2.2</version>
    > <!--scope>test</scope-->
    > </dependency>
    > </dependencies>
    > <build>
    > <plugins>
    > <plugin>
    > <artifactId>maven-antrun-plugin</artifactId>
    > <executions>
    > <execution>
    > <id>install</id>
    > <phase>install</phase>
    > <goals>
    > <goal>run</goal>
    > </goals>
    > <configuration>
    > <tasks>
    > <exec dir="C:\Maven\run-script"
    > executable="command.bat" os="Windows XP">
    > <arg value="set1-1"/>
    > </exec>
    > <exec dir="C:\Maven\run-script"
    > executable="command.bat" os="Windows XP">
    > <arg value="set1-2"/>
    > </exec>
    > <exec dir="C:\Maven\run-script" executable="command.bat" os="Windows
    > XP">
    > <arg value="set1-3"/>
    > </exec>
    > <scp file="command.bat" todir="wasadm@172.17.136.28:/apps/WebSphere"
    > password="wasadm"/>
    > </tasks>
    > </configuration>
    > </execution>
    > </executions>
    > </plugin>
    > </plugins>
    > </build>
    > </project>
    >
    > *******************************************************************************************************
    > Log printed on the console
    > *******************************************************************************************************
    >
    > C:\Maven\run-script>mvn install
    > [INFO] Scanning for projects...
    > [INFO]
    > -------------------------------------------------------------------------
    > ---
    > [INFO] Building Maven Quick Start Archetype
    > [INFO] task-segment: [install]
    > [INFO]
    > -------------------------------------------------------------------------
    > ---
    > [INFO] [resources:resources]
    > [INFO] Using default encoding to copy filtered resources.
    > [INFO] [compiler:compile]
    > [INFO] Nothing to compile - all classes are up to date
    > [INFO] [resources:testResources]
    > [INFO] Using default encoding to copy filtered resources.
    > [INFO] [compiler:testCompile]
    > [INFO] Nothing to compile - all classes are up to date
    > [INFO] [surefire:test]
    > [INFO] Surefire report directory:
    > C:\Maven\run-script\target\surefire-reports
    >
    > -------------------------------------------------------
    > T E S T S
    > -------------------------------------------------------
    > Running com.kaiser.build.AppTest
    > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032
    > sec
    >
    > Results :
    > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    >
    > [INFO] [jar:jar]
    > [INFO] Building jar:
    > C:\Maven\run-script\target\run-script-1.0-SNAPSHOT.jar
    > [INFO] [install:install]
    > [INFO] Installing
    > C:\Maven\run-script\target\run-script-1.0-SNAPSHOT.jar to C:\D
    > ocuments and
    > Settings\kumar\.m2\repository\com\kaiser\build\run-script\1.0-SNAPS
    > HOT\run-script-1.0-SNAPSHOT.jar
    > [INFO] [antrun:run {execution: install}]
    > [INFO] Executing tasks
    > [exec] set1-1
    > [exec] set1-2
    > [exec] set1-3
    > [INFO]
    > ------------------------------------------------------------------------
    > [ERROR] BUILD ERROR
    > [INFO]
    > ------------------------------------------------------------------------
    > [INFO] Error executing ant tasks
    >
    > Embedded error: Could not create task or type of type: scp.
    >
    > 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 'scp'.
    > 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.
    > Fix: check the documentation for dependencies.
    > Fix: declare the task.
    > - The task is an Ant optional task and the JAR file and/or libraries
    > implementing the functionality were not found at the time you
    > yourself built your installation of Ant from the Ant sources.
    > Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to
    > the
    > task and make sure it contains more than merely a
    > META-INF/MANIFEST.MF.
    > If all it contains is the manifest, then rebuild Ant with the
    > needed
    > libraries present in ${ant.home}/lib/optional/ , or alternatively,
    > download a pre-built release version from apache.org
    > - The build file was written for a later version of Ant
    > Fix: upgrade to at least the latest release version of Ant
    > - The task is not an Ant core or optional task
    > and needs to be declared using <taskdef>.
    > - You are attempting to use a task defined using
    > <presetdef> or <macrodef> but have spelt wrong or not
    > defined it at the point of use
    >
    > Remember that for JAR files to be visible to Ant tasks implemented
    > in ANT_HOME/lib, the files must be in the same directory or on the
    > classpath
    >
    > Please neither file bug reports on this problem, nor email the
    > Ant mailing lists, until all of these causes have been explored,
    > as this is not an Ant bug.
    > [INFO]
    > ------------------------------------------------------------------------
    > [INFO] For more information, run Maven with the -e switch
    > [INFO]
    > ------------------------------------------------------------------------
    > [INFO] Total time: 2 seconds
    > [INFO] Finished at: Tue Jul 25 17:09:14 IST 2006
    > [INFO] Final Memory: 5M/9M
    > [INFO]
    > ------------------------------------------------------------------------
    >
    > C:\Maven\run-script>
    > *******************************************************************************************************


    I also had your same problem and I solved it putting needed
    dependencies inside the antrun plugin declaration. So try with this:
    ....
    <plugins>
    <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
    ...
    </executions>
    <dependencies>
    <dependency>
    <groupId>ant</groupId>
    <artifactId>ant-jsch</artifactId>
    <version>1.6.5</version>
    </dependency>
    <dependency>
    <groupId>jsch</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.25</version>
    </dependency>
    </dependencies>
    </plugin>
    </plugins>
    ....
    Marco Meschieri, Aug 9, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor
    Replies:
    0
    Views:
    8,815
    Victor
    Sep 1, 2004
  2. Marcin Cenkier
    Replies:
    1
    Views:
    5,381
    Marcin Cenkier
    Apr 12, 2006
  3. Abder-Rahman

    Maven Ant Task

    Abder-Rahman, Feb 11, 2009, in forum: Java
    Replies:
    0
    Views:
    537
    Abder-Rahman
    Feb 11, 2009
  4. Une Bévue
    Replies:
    0
    Views:
    362
    Une Bévue
    Jul 22, 2008
  5. manos
    Replies:
    0
    Views:
    211
    manos
    Oct 6, 2007
Loading...

Share This Page