1

私は次のものを持っています:

  • で走っeclipse-indigoているCentOS 6.2
  • apache-ant-1.8.4また、システムにインストールし、ANT_HOME変数を に設定しましたeclipse
  • Eclipse では、システムにインストールされているバージョンmaven2を使用するプラグインをインストールしました (使用するように構成しました)。maven-3.0.4eclipse

私は日食にmavenプロジェクトを持っており、いつでもinstall-(maven目標)-結果のjarファイルをサーバーの特定の場所にコピーしたいと思っていますssh。このために、私は自分で次のことを行いましたpom.xml



   <build>
    <plugins >
            <plugin>
        <groupId > org.apache.maven.plugins </groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>install</phase>
                    <configuration>
                        <tasks name="ssh_task">
                            <taskdef name="scp" 
                                      classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" classpathref="/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jsch.jar" />
                            <scp file="/absolute/path/to/myfile.jar" 
                                 todir="root@$10.3.1.1:/remote/location" 
                                 password="mypass" 
                                 trusted="true"/>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>


pom.xmlこの投稿に従って、そのように構成しました:

問題は、installゴールを実行するeclipseと次のエラーが発生することです。

エラー] プロジェクト myprojectname で目標 org.apache.maven.plugins:maven-antrun-plugin:1.3:run (デフォルト) を実行できませんでした: Ant BuildException が発生しました: Reference /usr/local/apache-ant/apache-ant- 1.8.4/lib/ant-jsch.jar が見つかりません。→【ヘルプ1】

問題は、ant-jsch.jarそこにあるということです。

質問: 私の問題に対処する方法について何か提案はありますか? 完全なスタック トレースを知りたい場合は、教えてください。

編集:


ant -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.8.4 compiled on May 22 2012

-------------------------------------------
 Implementation Version
-------------------------------------------
core tasks     : 1.8.4 in file:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant.jar

-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
ant.java.version: 1.6
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: /usr/local/apache-ant/apache-ant-1.8.4/lib/ant.jar
ant.home: /usr/local/apache-ant/apache-ant-1.8.4

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /usr/local/apache-ant/apache-ant-1.8.4
commons-logging-1.0.4.jar (38015 bytes)
jruby-0.9.8.jar (1683526 bytes)
servlet-api-2.3.jar (77977 bytes)
serializer-2.7.1.jar (278281 bytes)
jasper-compiler-4.1.36.jar (184124 bytes)
commons-logging-api-1.1.jar (44598 bytes)
bcel-5.1.jar (515920 bytes)
xml-apis-1.3.04.jar (194354 bytes)
ant-javamail.jar (13773 bytes)
ant-commons-logging.jar (9715 bytes)
jsch-0.1.42.jar (185746 bytes)
log4j-1.2.14.jar (367444 bytes)
xalan-2.7.1.jar (3176148 bytes)
ant-jai.jar (28241 bytes)
ant-junit4.jar (12923 bytes)
ant-antlr.jar (11550 bytes)
jasper-runtime-4.1.36.jar (72397 bytes)
jai-core-1.1.3.jar (1900631 bytes)
ant-netrexx.jar (16215 bytes)
ant-junit.jar (108138 bytes)
bsh-core-2.0b4.jar (143992 bytes)
ant-jdepend.jar (14024 bytes)
asm-commons-2.2.3.jar (15114 bytes)
regexp-1.2.jar (29871 bytes)
ant.jar (1941731 bytes)
regexp-1.3.jar (25429 bytes)
commons-net-1.4.1.jar (180792 bytes)
ant-jsch.jar (46176 bytes)
asm-2.2.3.jar (34832 bytes)
bsh-2.0b4.jar (281694 bytes)
ant-apache-oro.jar (45515 bytes)
antlr-2.7.7.jar (445288 bytes)
mail-1.4.jar (388864 bytes)
ant-jmf.jar (12541 bytes)
asm-tree-2.2.3.jar (16248 bytes)
js-1.6R7.jar (813521 bytes)
activation-1.1.jar (62983 bytes)
ant-testutil.jar (21004 bytes)
ant-apache-bcel.jar (14548 bytes)
ant-swing.jar (13497 bytes)
ant-commons-net.jar (91451 bytes)
junit-4.8.1.jar (237047 bytes)
ant-apache-xalan2.jar (8097 bytes)
jdepend-2.9.1.jar (57933 bytes)
ant-apache-regexp.jar (9563 bytes)
maven-artifact-ant-2.0.4-dep.jar (887507 bytes)
oro-2.0.8.jar (65261 bytes)
which-1.0.jar (17398 bytes)
jai-codec-1.1.3.jar (258160 bytes)
ant-apache-resolver.jar (9886 bytes)
bsf-2.4.0.jar (113369 bytes)
NetRexxC.jar (355931 bytes)
ant-launcher.jar (18429 bytes)
ant-apache-log4j.jar (8861 bytes)
ant-apache-bsf.jar (9733 bytes)
xml-resolver-1.2.jar (84091 bytes)

-------------------------------------------
 USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: /root
No such directory.

-------------------------------------------
 Tasks availability
-------------------------------------------
All defined tasks are available

-------------------------------------------
 org.apache.env.Which diagnostics
-------------------------------------------
#---- BEGIN: Which report
Which.version=Which.java:($Revision: 1.2 $) WhichJar.java:($Revision: 1.2 $)
java.version=1.6.0_31
file.encoding=UTF-8
java.ext.dirs=/usr/java/jdk1.6.0_31/jre/lib/ext:/usr/java/packages/lib/ext
java.class.path=/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-launcher.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-logging-1.0.4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jruby-0.9.8.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/servlet-api-2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/serializer-2.7.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jasper-compiler-4.1.36.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-logging-api-1.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bcel-5.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xml-apis-1.3.04.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-javamail.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-commons-logging.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jsch-0.1.42.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/log4j-1.2.14.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xalan-2.7.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jai.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-junit4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-antlr.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jasper-runtime-4.1.36.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jai-core-1.1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-netrexx.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-junit.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsh-core-2.0b4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jdepend.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-commons-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/regexp-1.2.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/regexp-1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-net-1.4.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jsch.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsh-2.0b4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-oro.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/antlr-2.7.7.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/mail-1.4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jmf.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-tree-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/js-1.6R7.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/activation-1.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-testutil.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-bcel.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-swing.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-commons-net.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/junit-4.8.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-xalan2.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jdepend-2.9.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-regexp.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/maven-artifact-ant-2.0.4-dep.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/oro-2.0.8.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/which-1.0.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jai-codec-1.1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-resolver.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsf-2.4.0.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/NetRexxC.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-launcher.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-log4j.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-bsf.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xml-resolver-1.2.jar:/usr/java/jdk1.6.0_31/lib/tools.jar
os.name=Linux
java.vendor=Sun Microsystems Inc.
sun.boot.class.path=/usr/java/jdk1.6.0_31/jre/lib/resources.jar:/usr/java/jdk1.6.0_31/jre/lib/rt.jar:/usr/java/jdk1.6.0_31/jre/lib/sunrsasign.jar:/usr/java/jdk1.6.0_31/jre/lib/jsse.jar:/usr/java/jdk1.6.0_31/jre/lib/jce.jar:/usr/java/jdk1.6.0_31/jre/lib/charsets.jar:/usr/java/jdk1.6.0_31/jre/lib/modules/jdk.boot.jar:/usr/java/jdk1.6.0_31/jre/classes
java.runtime.name=Java(TM) SE Runtime Environment
#----   END: Which report

-------------------------------------------
 XML Parser information
-------------------------------------------
XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
XML Parser Location: unknown
Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Namespace-aware parser Location: unknown

-------------------------------------------
 XSLT Processor information
-------------------------------------------
XSLT Processor : org.apache.xalan.transformer.TransformerIdentityImpl
XSLT Processor Location: file:/usr/local/apache-ant/apache-ant-1.8.4/lib/xalan-2.7.1.jar

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : /usr/java/jdk1.6.0_31/jre/lib/i386
java.vm.version : 20.6-b01
ant.library.dir : /usr/local/apache-ant/apache-ant-1.8.4/lib
java.vm.vendor : Sun Microsystems Inc.
java.vendor.url : http://java.sun.com/
path.separator : :
java.vm.name : Java HotSpot(TM) Server VM
file.encoding.pkg : sun.io
user.country : US
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /home/artaxerxe
java.runtime.version : 1.6.0_31-b04
java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
java.endorsed.dirs : /usr/java/jdk1.6.0_31/jre/lib/endorsed
os.arch : i386
java.io.tmpdir : /tmp
line.separator : 

java.vm.specification.vendor : Sun Microsystems Inc.
os.name : Linux
ant.home : /usr/local/apache-ant/apache-ant-1.8.4
sun.jnu.encoding : UTF-8
java.library.path : /usr/java/jdk1.6.0_31/jre/lib/i386/server:/usr/java/jdk1.6.0_31/jre/lib/i386:/usr/java/jdk1.6.0_31/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
java.specification.name : Java Platform API Specification
java.class.version : 50.0
sun.management.compiler : HotSpot Tiered Compilers
os.version : 2.6.32-220.17.1.el6.i686
user.home : /root
user.timezone : Europe/Bucharest
java.awt.printerjob : sun.print.PSPrinterJob
file.encoding : UTF-8
java.specification.version : 1.6
user.name : root
java.class.path : /usr/local/apache-ant/apache-ant-1.8.4/lib/ant-launcher.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-logging-1.0.4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jruby-0.9.8.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/servlet-api-2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/serializer-2.7.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jasper-compiler-4.1.36.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-logging-api-1.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bcel-5.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xml-apis-1.3.04.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-javamail.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-commons-logging.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jsch-0.1.42.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/log4j-1.2.14.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xalan-2.7.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jai.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-junit4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-antlr.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jasper-runtime-4.1.36.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jai-core-1.1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-netrexx.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-junit.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsh-core-2.0b4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jdepend.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-commons-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/regexp-1.2.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/regexp-1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/commons-net-1.4.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jsch.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsh-2.0b4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-oro.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/antlr-2.7.7.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/mail-1.4.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-jmf.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/asm-tree-2.2.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/js-1.6R7.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/activation-1.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-testutil.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-bcel.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-swing.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-commons-net.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/junit-4.8.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-xalan2.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jdepend-2.9.1.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-regexp.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/maven-artifact-ant-2.0.4-dep.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/oro-2.0.8.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/which-1.0.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/jai-codec-1.1.3.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-resolver.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/bsf-2.4.0.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/NetRexxC.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-launcher.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-log4j.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/ant-apache-bsf.jar:/usr/local/apache-ant/apache-ant-1.8.4/lib/xml-resolver-1.2.jar:/usr/java/jdk1.6.0_31/lib/tools.jar
java.vm.specification.version : 1.0
sun.arch.data.model : 32
java.home : /usr/java/jdk1.6.0_31/jre
sun.java.command : org.apache.tools.ant.launch.Launcher -cp  -diagnostics
java.specification.vendor : Sun Microsystems Inc.
user.language : en
java.vm.info : mixed mode
java.version : 1.6.0_31
java.ext.dirs : /usr/java/jdk1.6.0_31/jre/lib/ext:/usr/java/packages/lib/ext
sun.boot.class.path : /usr/java/jdk1.6.0_31/jre/lib/resources.jar:/usr/java/jdk1.6.0_31/jre/lib/rt.jar:/usr/java/jdk1.6.0_31/jre/lib/sunrsasign.jar:/usr/java/jdk1.6.0_31/jre/lib/jsse.jar:/usr/java/jdk1.6.0_31/jre/lib/jce.jar:/usr/java/jdk1.6.0_31/jre/lib/charsets.jar:/usr/java/jdk1.6.0_31/jre/lib/modules/jdk.boot.jar:/usr/java/jdk1.6.0_31/jre/classes
java.vendor : Sun Microsystems Inc.
file.separator : /
java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.desktop : gnome
sun.cpu.isalist : 

-------------------------------------------
 Temp dir
-------------------------------------------
Temp dir is /tmp
Temp dir is writeable
Temp dir alignment with system clock is -731 ms

-------------------------------------------
 Locale information
-------------------------------------------
Timezone Eastern European Time offset=10800000

-------------------------------------------
 Proxy information
-------------------------------------------
Java1.5+ proxy settings:
Direct connection
4

2 に答える 2

2

classpathref以前に定義されたプロパティへの参照を定義するために使用されます。

クラスパス変数を定義してみてください:

<path id="jsch-classpath">
        <fileset dir="/usr/local/apache-ant/apache-ant-1.8.4/lib/" includes="ant-jsch.jar"/>
</path>

そしてそれをタスクで使用します:

<taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" classpathref="jsch-classpath" />
于 2012-06-21T08:30:50.683 に答える
0

Mavenのインストールフェーズは、アーティファクトをローカルリポジトリにインストールすることを目的としており、ファイルをリモートサーバーに転送することを目的としていません。Tomcat / JBossにアーティファクトをデプロイしようとしている場合は、アーティファクトをサーバーにデプロイすることを目的としたcargo2-maven-pluginまたはtomcat-maven-pluginを確認することをお勧めします。

さらに、この場合はAntを使用する代わりに、 maven-wagon-pluginを使用してアーティファクトをサーバーにアップロードすることをお勧めします。これにより、作業が楽になります。

于 2012-06-21T08:13:12.233 に答える