在maven构建期间执行shellscript时发生错误

时间:2017-06-19 08:57:30

标签: java shell maven ant maven-plugin

我正在尝试在maven构建期间在远程linux服务器中执行shell脚本。

以下是我在pom.xml中用于此目的的代码

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
     <execution>
            <id>server-copy</id>
            <goals>
                <goal>run</goal>
            </goals>
            <phase>process-sources</phase>
            <configuration>
            <tasks>

            <sshexec host="hostserver" username="user" trust="true" 
                        password="password" failonerror="true"  timeout="1200"
                        command="sh /pathofshellscript/test.sh"/> 
            </tasks>
            </configuration>
        </execution>
<executions>

控制台输出:

[INFO] Building test1 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-antrun-plugin:1.3:run (server-copy) @ test1 ---
[INFO] Executing tasks
  [sshexec] Connecting to hostserver:22
**Kerberos username [user109]:** user
**Kerberos password for user109:** password
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:02 min
[INFO] Finished at: 2017-06-19T14:06:27+05:30
[INFO] Final Memory: 9M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (server-copy) on project test1: An Ant BuildException has occured: com.jcraft.jsch.JSchException: Auth fail -> [Help 1]

当我执行maven build时,它会在控制台中询问Kerberos用户名和密码。我不知道为什么它要求用户名和密码,因为我已经在pom.xml中提供了。我有什么遗失的东西吗?

0 个答案:

没有答案
相关问题