On Sun, 22 Jun 2008 06:02:48 am Jason van Zyl wrote:
> Use the maven-dependency-plugin, it can retrieve artifacts and place
> them so that you can subsequently process them. I suggest staying away
> from the artifact resolver directly.

Then I need to know how to drive maven-dependency-plugin programatically 
within another plugin.

Basically I'm tring to drive IzPack with custom panels that need to be copied 
into the correct location for IzPack to use. The panels would be artifacts 
that would be specified using something like the following config structure 
in the project that invoked my plugin:

            <configuration>
              <izPackDir>/usr/local/IzPack-3.10.2/</izPackDir>
              <input>src/main/izpack/izpack-config.xml</input>
              <customPanels>
                <customPanel>
                  <groupId>foo.bar</groupId>
                  <artifactId>DoSomethingPanel</artifactId>
                  <version>1.0</version>
                </customPanel>
              </customPanels>
            </configuration>

I searched but could find no documentation that explained how I might do that 
with the dependency plugin, which is why the approach in the cookbook looked 
usable.

By the way...why stay away from directly using the artifact resolution API? 
Isn't it meant to be used externally? Since I could find so little 
documentation on using maven components in a plugin, it strikes me that 
someone who knows the internals should make a concise and complete guide 
listing all the components and interfaces that people like me can use, rather 
than the vague hints out there.

If I did miss some obvious documentation, then I apologise for casting 
nasturtiums. Maven's been great from a user's perspective, but harder to 
dissect from a developer's perspective.

Eric

>
> On 20-Jun-08, at 7:59 PM, ericr wrote:
> > Hi,
> >
> > I'm trying to develop a plugin in which I want to resolve an
> > artifact so
> > that I can copy it somewhere special before using it. Not knowing
> > how (or if
> > it's even possible) to embed the dependency plugin's resolution
> > functionality, I decided to take what seemed like a simpler approach
> > and
> > perform the basic resolution myself, as according to
> > http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook.
> >
> > Unfortunately I get the following NPE:
> >
> > Caused by: java.lang.NullPointerException
> >     at
> > org
> > .apache
> > .maven
> > .artifact
> > .resolver
> > .DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:129)
> >     at
> > org
> > .apache
> > .maven
> > .artifact
> > .resolver
> > .DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:74)
> >     at
> > com
> > .izforge
> > .izpack.maven.plugins.IzPackMojo.copyCustomPanels(IzPackMojo.java:174)
> >
> > The code snippet that I wrote is as follows:
> >   /** @component */
> >   private org.apache.maven.artifact.factory.ArtifactFactory
> > artifactFactory;
> >
> >   /** @component */
> >   private org.apache.maven.artifact.resolver.ArtifactResolver
> > resolver;
> >
> >  someMethod() {
> >         Artifact panelArtifact =
> > artifactFactory.createArtifactWithClassifier(groupId, artifactId,
> > version,
> > "jar", "");
> >         try
> >         {
> >            resolver.resolve(panelArtifact, remoteRepositories,
> > localRepository);
> >
> > Do I need to create a variable in my plugin  to store a component
> > similar to
> > the the ArtifactFactory and ArtifactResolver mentioned in the
> > cookbook? Is
> > there a better set of documentation that explains how to accomplish
> > such
> > tasks?
> >
> > Eric
> >
> > --
> > View this message in context:
> > http://www.nabble.com/A-question-about-artifact-resolution-tp18040514p180
> >40514.html Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
> the course of true love never did run smooth ...
>
>   -- Shakespeare
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



-- 
"Anything that is in the world when you're born is normal and ordinary and is 
just a natural part of the way the world works. Anything that's invented 
between when you're fifteen and thirty-five is new and exciting and 
revolutionary and you can probably get a career in it. Anything invented 
after you're thirty-five is against the natural order of things."

-- Douglas Adams

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to