maven antrun ssh or scp hides the output

后端 未结 2 853
青春惊慌失措
青春惊慌失措 2021-01-16 16:52

I want to run an ssh & scp commands using antrun in mvn.
the ssh & scp commands runs correctly, and the plugins that declared inthe next phases - run. but the ou

相关标签:
2条回答
  • 2021-01-16 17:33

    Thank you very much. After two long evenings I found the solution.

    I had the latest version of ant and not org.apache.ant which was changed at version 1.6 So latest version is today 1.10.1 and it works very well.

    0 讨论(0)
  • 2021-01-16 17:45

    Give it a try with newer versions of JSCH dependencies (1.8.4 for ant-jsch and 0.1.53 for jsch, each with different group ids). It fixed the problem on my side:

    <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>
                    <target>
                        <echo message="Pushing to host..." />
                        <sshexec host="hostname" username="user" trust="true" 
                            password="pass" failonerror="true"  
                            command="mkdir -p /home/user/test/test"/> 
                        <scp trust="yes"
                            file="some-file"
                            todir="user:pass@hostname:/path/to/some-file" 
                            />
                    </target>
                </configuration>
            </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.apache.ant</groupId>
                <artifactId>ant-jsch</artifactId>
                <version>1.8.4</version>
            </dependency>
            <dependency>
                <groupId>com.jcraft</groupId>
                <artifactId>jsch</artifactId>
                <version>0.1.53</version>
            </dependency>
        </dependencies>
    </plugin>
    
    0 讨论(0)
提交回复
热议问题