Hi there,

I'm trying to get a very simple utility mojo working which will essentially 
start off by doing an scp (hopefully utilising wagon-maven-download:download 
programatically in java) and then doing some further custom processing on the 
zip/tar.

I'm obviously missing something basic, however, as I can't seem to do in java 
what is quite simple in a pom plugin execution[1]. Hopefully someone can point 
me in the right direction.

Essentially my Mojo has:
/**
 * @goal some-goal
 * @requiresDirectInvocation true
 * @requiresProject false
 */

i.e., I want to be able to run this outside of a project (like one does for 
archetype:generate). I'm subclassing AbstractWagonMojo but neither 'settings' 
nor 'wagonManager' have been initialised when execute starts to run. Any ideas 
why? 

Thus when I call createWagon(serverId, url) I get a NullPointerException:
org.apache.maven.plugin.MojoExecutionException: Unable to create a Wagon 
instance for scp://foo.bar.net/
        at 
org.codehaus.mojo.wagon.AbstractWagonMojo.createWagon(AbstractWagonMojo:83)
        <...>
Caused by: java.lang.NullPointerException
        at 
org.apache.maven.artifact.manager.DefaultWagonManager.getWagon(DefaultWagonManager.java:143)
        at 
org.apache.maven.artifact.manager.DefaultWagonManager.getWagon(DefaultWagonManager.java:128)
        at 
org.codehaus.mojo.wagon.shared.WagonUtils.createWagon(AbstractWagonMojo:53)
        at 
org.codehaus.mojo.wagon.AbstractWagonMojo.createWagon(AbstractWagonMojo:79)
        ... 21 more

Essentially,
- how do I utilise scp via a wagon programatically?
- why do the following variables remain null if @requiresProject false is set?
        /**
         * @component
         */
        protected WagonManager wagonManager;
        /**
         * @parameter expression="${settings}"
         * @readonly
         */
        protected Settings settings;

Thanks!

with regards,
--

Lachlan Deck

[1] 
<build>
        ...
        <extensions>
                <extension>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh</artifactId>
                        <version>1.0-beta-6</version>
                </extension>
        </extensions>
        <plugins>
                ...
                <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>wagon-maven-download</artifactId>
                        <version>1.0-beta-3</version>
                        <executions>
                                <execution>
                                        <id>foo</id>
                                        <phase>verify</phase>
                                        <goals>
                                                <goal>download</goal>
                                        </goals>
                                        <configuration>
                                                <serverId>bar</serverId>
                                                <url>scp://bar.foo.net/</url>
                                                <fromDir>/some/dir/</fromDir>
                                                <includes>myzip.zip</includes>
                                                <toDir>/tmp</toDir>
                                        </configuration>
                                </execution>
                        </executions>
                </plugin>
        </plugins>
</build>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to