我創建了此配置文件,用於通過SCP在服務器上部署工件。我知道Ant的scp任務是可選的,因此我添加了依賴關係。忽略Maven插件依賴關係
<profiles>
<profile>
<id>remote-deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>scp</id>
<phase>install</phase>
<configuration>
<tasks>
<scp .../>
<sshexec .../>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
然而,當我運行的配置文件,我結束了
的螞蟻BuildException已發生: 問題:無法創建任務或鍵入 SCP原因:類 org.apache .tools.ant.taskdefs.optional.ssh.Scp 未找到。 這看起來像是Ant的可選組件之一。操作:檢查 了相應的可選JAR 在 -ANT_HOME \ lib中 -the IDE Ant配置對話框
存在,不要驚慌,這是一種常見的 問題。最常見的原因是 缺少JAR。
這不是一個錯誤;它是一個 配置問題
是否有可能maven無法下載這些依賴或它只是忽略它們?
Maven部署插件不是一個選項,因爲我沒有部署到遠程存儲庫,但遠程服務器 - 我仍然需要執行一些特定於服務器的unix命令。 – 2011-01-14 09:56:40