javamaven-2mavenwagonmaven-wagon-plugin

maven upload file per scp


whats the preferred way to upload an artifact via scp to a predefined destination? i tried using the wagon:upload mojo, but it wont execute atomatically when i defined a "executions" section in my pom like that:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0-beta-3</version>
    <executions>
        <execution>
            <phase>release</phase>
            <goals>
                <goal>upload</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <fromDir>target/checkout/target</fromDir>
        <includes>*.jar</includes>
        <url>scpexe://host/dir</url>
        <toDir />
        <serverId>my id</serverId>
    </configuration>
</plugin>

i added the necessary extension wagon-ssh and wagon-ssh-external and it all works fine when i execute wagon:upload but it wont upload the artifact automatically in the release phase.

Is this even the right way to upload artifacts to a website, or should the deploy plugin take care of that?

thanks!


Solution

  • That's because no release phase exists (see Maven Lifecycle Reference)

    You probably want phase deploy. And yes, wagon is usually used by the maven deploy plugin (automatically when you execute mvn deploy).