본문 바로가기

Util & Etc & Build Tool/Maven

[Maven] Maven Ant를 이용하여 서버로 jar 파일 전송 (SCP 이용)

http://www.sangron.com/untitled/textyle/22682 참고


유의할점 : 

1) 버전은 해당 사이트에 나온 그대로 쓰자.

2) 서버에 scp 설치되있어야함. ssh 설치하자. sshd랑




<deploy.target.dir>dist</deploy.target.dir>

<lib.dir>lib</lib.dir>

<jar.name>hadoop-example</jar.name>

<scp.user>hduser</scp.user>

<scp.password>1234</scp.password>

<scp.host>192.168.56.102</scp.host>

<scp.dirCopyTo>/usr/local/hadoop/example</scp.dirCopyTo>



<plugin>

    <artifactId>maven-antrun-plugin</artifactId>

    <executions>

        <execution>

            <phase>install</phase>

            <goals>

                <goal>run</goal>

            </goals>

            <configuration>

                <tasks>

                    <scp file="${deploy.target.dir}/${jar.name}.jar"

                        todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyTo}" />

                </tasks>

            </configuration>

        </execution>

    </executions>

    <dependencies>

        <dependency>

            <groupId>ant</groupId>

            <artifactId>ant-jsch</artifactId>

            <version>1.6.5</version>

        </dependency>

        <dependency>

            <groupId>com.jcraft</groupId>

            <artifactId>jsch</artifactId>

            <version>0.1.42</version>

        </dependency>

    </dependencies>

</plugin>