Anyone more familiar with mojo development able to answer?

Or am I on the wrong list?

On 25/05/2010, at 2:00 PM, Dan Tran wrote:

> I would suggest you cut and paste wagon:download code then

That doesn't help answer my questions below.

On Mon, May 24, 2010 at 6:54 PM, Lachlan Deck <[email protected]> wrote:
> Hi there,
> 
> I'm trying to get a very simple utility working which downloads a zip file 
> for subsequent use.
> 
> I can successfully do this via an execution in the pom[1] but can't seem to 
> get it working programatically (which I need to be able to run the mojo 
> independently).
> 
> In order to create a stand alone utility that could run outside a project 
> (mvn some.groupId:project-id:downloadzip ...) I seem to be missing something. 
> i.e., when I've got the mojo with @requiresProject false  the 'settings' and 
> 'wagonManager' in AbstractMojo aren't initialised.
> 
> 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 the scp wagon programatically?
> - if the mojo is running outside a project, how do @component annotated 
> fields (like Settings or WagonManager) get populated?
> etc
> 
> 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, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to