KARAF / karaf star
2022-12-17
Open
#4 org.codehaus.mojo/exec-maven-plugin 를 이용한 lftp & sftp 명령 실행 (파일 업로드) star
2022-12-17 Open
Tasks

lftp 설치#

brew install lftp
  • 우분투
sudo apt install lftp

pom.xml에 추가#

  • ${sftpUserPass}은 userid 및 password 보호를 위해 settings.xml properties에 선언
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <inherited>false</inherited>
    <executions>
        <execution>
            <id>sftp-to-remote</id>
            <phase>install</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>lftp</executable>
                <arguments>
                    <argument>sftp://${sftpUserPass}@localhost:18822</argument>
                    <argument>-e</argument>
                    <argument>cd /app/tomcat/webapps/test/WEB-INF/lib; put ${project.basedir}/target/test-lib.jar; bye</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

settings.xml#

        <profile>
            <id>dev</id>
            <activation>
            <jdk>1.8</jdk>
            </activation>
            <properties>
                <sftpUserPass>king:test%21%40345</sftpUserPass>
...
Issue Sharer
Comment 0

Add a comment
New subtask
Assignee
No assignee
Due date
No due date
Label
maven
Comment 0