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

-Dan

On Mon, May 24, 2010 at 8:55 PM, Lachlan Deck <lachlan.d...@gmail.com> wrote:
> On 25/05/2010, at 1:46 PM, Dan Tran wrote:
>
>> ah sorry,
>>
>> from wagon-maven-plugin, wagon:download can run outside of maven project
>
> Yep - but I don't need that. To reiterate: I'm creating my own mojo which 
> will do something similar to start with but will do other things as well ... 
> so my question remains: how can this be done programatically? i.e., in 'java' 
> not via the pom.xml?
>
>>
>> -Dan
>>
>> On Mon, May 24, 2010 at 8:28 PM, Lachlan Deck <lachlan.d...@gmail.com> wrote:
>>> I'm not sure I understand your question? My dependencies already contains 
>>> wagon-maven-plugin but what java classes are you particularly referring to 
>>> in order to make this work programatically (rather than via a pom 
>>> execution)?
>>>
>>> i.e., to be clearer: I'm writing a mojo, or trying to, that can execute 
>>> with @requiresProject false etc
>>>
>>> On 25/05/2010, at 12:46 PM, Dan Tran wrote:
>>>
>>>> is there any reason, you are not using wagon-maven-plugin at MOJO?
>>>>
>>>> -Dan
>>>>
>>>> On Mon, May 24, 2010 at 6:54 PM, Lachlan Deck <lachlan.d...@gmail.com> 
>>>> 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: users-unsubscr...@maven.apache.org
>>>>> For additional commands, e-mail: users-h...@maven.apache.org
>>>>>
>>>>>
>>>
>>> with regards,
>>> --
>>>
>>> Lachlan Deck
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>>> For additional commands, e-mail: users-h...@maven.apache.org
>>>
>>>
>
> with regards,
> --
>
> Lachlan Deck
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to