RE: A question about artifact resolution
Eric, I'm the author of the dependency plugin and I agree it's a little convoluted now but I didn't want to refactor again before 2.0. It shouldn't be too bad though because I tried to encapsulate the majority of the real work in super classes to reduce the code across all the mojos. Some of the filters and other things I did manage to pull out to another shared component, but the resolution code is not...probably it could be. If I were going to try to attempt this now without refactoring, I would copy the dependency plugin, extend the AbstractFromConfiguration with your class and toss everything else that isn't used. The ArtifactItem bean is where the config is pulled in from the pom and the AbstractFromConfiguration does all the processing for you. If you look at the execute for copy, it can't get much easier as a consumer of this abstract class: public void execute() throws MojoExecutionException { This does all the processing: ArrayList theArtifactItems = getProcessedArtifactItems( this.stripVersion ); Walk the list: Iterator iter = theArtifactItems.iterator(); while ( iter.hasNext() ) { ArtifactItem artifactItem = (ArtifactItem) iter.next(); Certain rules in the ArtifactItem decide if processing is needed...like if the file is already up to date, etc. This is done via filters and marker files because unpacked files aren't as easy to check. if ( artifactItem.isNeedsProcessing() ) { Then just copy it. copyArtifact( artifactItem ); } else { this.getLog().info( artifactItem + already exists in + artifactItem.getOutputDirectory() ); } } } Jason's advice to avoid the resolver api directly is probably two fold...first, it's quite frankly not an API. There is no single method to deal with getting what you want. The code I have is a close approximation but there are some missing things, first it doesn't handle ranges and second it doesn't find things in sibling projects not already installed. This means you effectively need to figure out the core and recode 99% of what's in there...and trust me that's no small task. The second reason is because the maven-artifact code is significantly reworked in 2.1 and you don't want to tie yourself too closely to the mess that's here. Again it stems from the fact that what's there really isn't an API...you're hooking in all over the place. --Brian -Original Message- From: Eric Rose [mailto:[EMAIL PROTECTED] Sent: Sunday, June 22, 2008 4:21 AM To: Maven Users List Subject: Re: A question about artifact resolution 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 inputsrc/main/izpack/izpack-config.xml/input customPanels customPanel groupIdfoo.bar/groupId artifactIdDoSomethingPanel/artifactId version1.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
Re: A question about artifact resolution
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. Why is that? Surely the dependency plugin can't be appropriate for every case of artifact resolution. If the artifact resolver API isn't usable as-is, or is not documented fully I would expect that to be a problem to be addressed. To expand on my problem, I am trying to write a wrapper around IzPack so that installers can be created with custom panels. A project calling my plugin would have configuration something like: plugin configuration customPanels customPanel groupIdfoo.bar/groupId artifactIdMyCustomPanel/artifactId version1.0/version /customPanel /customPanels /configuration /plugin If there's a way I can call the dependency plugin programatically from my plugin, to pass along the parsed artifact information from the calling project, I'd like to know. So far I have not found anything, hence my decision to follow the documentation path that seemed to exist for calling the resolver directly. In fact, there appears no information I could find on how, if it is at all possible, to embed plugins within plugins, in such a manner. Should the general principle be something like? FooPlugin foo = new FooPlugin(); foo.setBar1(xxx); foo.setBar2(yy); foo.execute(); where setBarX() methods mirror the plugin parameters? By the way, there appears to be scant information on what components can be used and how to use them property. Is there a definitive set of documentation that I should be looking at? If I'm casting nasturtiums unjustly, I apologise, but maven appears great from a user's perspective and very hard to pull apart from a programmer's perspective, and that's mainly a documentation issue, IMO. 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] -- Eric Rose | Don't blame me - [EMAIL PROTECTED] | I didn't vote for him. *** This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you must not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify the sender immediately. Any views expressed
Re: A question about artifact resolution
On 22-Jun-08, at 5:50 PM, Eric Rose wrote: 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. Why is that? Because from lots of experience I know you probably don't need it. Make your life simple, the dependency plugin is quite powerful. If you determine you want to use it directly the dependency plugin is a great example of how to use the APIs. Surely the dependency plugin can't be appropriate for every case of artifact resolution. If the artifact resolver API isn't usable as- is, or is not documented fully I would expect that to be a problem to be addressed. It has been in trunk, but that's not what's used on the 2.0.x line which is probably what you're using. To expand on my problem, I am trying to write a wrapper around IzPack so that installers can be created with custom panels. A project calling my plugin would have configuration something like: plugin configuration customPanels customPanel groupIdfoo.bar/groupId artifactIdMyCustomPanel/artifactId version1.0/version /customPanel /customPanels /configuration /plugin If there's a way I can call the dependency plugin programatically from my plugin, to pass along the parsed artifact information from the calling project, I'd like to know. So far I have not found anything, hence my decision to follow the documentation path that seemed to exist for calling the resolver directly. That's your solution. But your problem is putting some artifacts somewhere to be packaged up with an installer. If your requirement is to have all that code controlled from your plugin then use the resolver, but you can certainly solve your problem without it. The dependency plugin code would be a good place to start. In fact, there appears no information I could find on how, if it is at all possible, to embed plugins within plugins, in such a manner. Should the general principle be something like? Plugins depending on plugins is not a good thing. We learned the hard way with Maven 1.x where this was possible. FooPlugin foo = new FooPlugin(); foo.setBar1(xxx); foo.setBar2(yy); foo.execute(); where setBarX() methods mirror the plugin parameters? By the way, there appears to be scant information on what components can be used and how to use them property. Is there a definitive set of documentation that I should be looking at? If I'm casting nasturtiums unjustly, I apologise, but maven appears great from a user's perspective and very hard to pull apart from a programmer's perspective, and that's mainly a documentation issue, IMO. 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
Re: A question about artifact resolution
There are actively development works at IzPack to allow IzPack's custom panels to be pulled in via izpack-maven-plugin, please join your work to make this happen. the plugin site is at http://izpack.codehaus.org/izpack-maven-plugin -D On Sun, Jun 22, 2008 at 5:50 PM, Eric Rose [EMAIL PROTECTED] wrote: 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. Why is that? Surely the dependency plugin can't be appropriate for every case of artifact resolution. If the artifact resolver API isn't usable as-is, or is not documented fully I would expect that to be a problem to be addressed. To expand on my problem, I am trying to write a wrapper around IzPack so that installers can be created with custom panels. A project calling my plugin would have configuration something like: plugin configuration customPanels customPanel groupIdfoo.bar/groupId artifactIdMyCustomPanel/artifactId version1.0/version /customPanel /customPanels /configuration /plugin If there's a way I can call the dependency plugin programatically from my plugin, to pass along the parsed artifact information from the calling project, I'd like to know. So far I have not found anything, hence my decision to follow the documentation path that seemed to exist for calling the resolver directly. In fact, there appears no information I could find on how, if it is at all possible, to embed plugins within plugins, in such a manner. Should the general principle be something like? FooPlugin foo = new FooPlugin(); foo.setBar1(xxx); foo.setBar2(yy); foo.execute(); where setBarX() methods mirror the plugin parameters? By the way, there appears to be scant information on what components can be used and how to use them property. Is there a definitive set of documentation that I should be looking at? If I'm casting nasturtiums unjustly, I apologise, but maven appears great from a user's perspective and very hard to pull apart from a programmer's perspective, and that's mainly a documentation issue, IMO. 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] -- Eric Rose | Don't blame me - [EMAIL PROTECTED] | I didn't vote for him. *** This message contains privileged
Re: A question about artifact resolution
also once IZPACK-78 enhancement completes, we should be able to use just maven-dependency-plugin to pull in all custom panels and get bundled with the installer by izpack-standalone-compiler -D On Sun, Jun 22, 2008 at 10:19 PM, Dan Tran [EMAIL PROTECTED] wrote: There are actively development works at IzPack to allow IzPack's custom panels to be pulled in via izpack-maven-plugin, please join your work to make this happen. the plugin site is at http://izpack.codehaus.org/izpack-maven-plugin -D On Sun, Jun 22, 2008 at 5:50 PM, Eric Rose [EMAIL PROTECTED] wrote: 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. Why is that? Surely the dependency plugin can't be appropriate for every case of artifact resolution. If the artifact resolver API isn't usable as-is, or is not documented fully I would expect that to be a problem to be addressed. To expand on my problem, I am trying to write a wrapper around IzPack so that installers can be created with custom panels. A project calling my plugin would have configuration something like: plugin configuration customPanels customPanel groupIdfoo.bar/groupId artifactIdMyCustomPanel/artifactId version1.0/version /customPanel /customPanels /configuration /plugin If there's a way I can call the dependency plugin programatically from my plugin, to pass along the parsed artifact information from the calling project, I'd like to know. So far I have not found anything, hence my decision to follow the documentation path that seemed to exist for calling the resolver directly. In fact, there appears no information I could find on how, if it is at all possible, to embed plugins within plugins, in such a manner. Should the general principle be something like? FooPlugin foo = new FooPlugin(); foo.setBar1(xxx); foo.setBar2(yy); foo.execute(); where setBarX() methods mirror the plugin parameters? By the way, there appears to be scant information on what components can be used and how to use them property. Is there a definitive set of documentation that I should be looking at? If I'm casting nasturtiums unjustly, I apologise, but maven appears great from a user's perspective and very hard to pull apart from a programmer's perspective, and that's mainly a documentation issue, IMO. 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
Re: A question about artifact resolution
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-tp18040514p1 80 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] -- Eric Rose | Don't blame me - [EMAIL PROTECTED] | I didn't vote for him. *** This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you must not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify the sender immediately. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of another (including a Body Corporate). If you wish to opt out from future messages, send an email to [EMAIL PROTECTED] with the subject UNSUBSCRIBE Thanks, Jason -- Jason van Zyl Founder, Apache Maven jason at sonatype dot com -- We all have problems. How we deal with them is a measure of our worth. -- Unknown - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Eric Rose | Don't blame me - [EMAIL PROTECTED] | I didn't vote for him. *** This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you must not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify the sender immediately. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of another (including a Body Corporate). If you wish to opt out from future messages, send an email to [EMAIL PROTECTED] with the subject UNSUBSCRIBE signature.asc Description: This is a digitally signed message part.
Re: A question about artifact resolution
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. 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-tp18040514p18040514.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]
A question about artifact resolution
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-tp18040514p18040514.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]
Re: Question about artifact resolution
maybe MavenMetadataSource.retrieveAvailableVersions() or ArtifactCollector.collect can help you On 1/3/07, Matthew Beermann [EMAIL PROTECTED] wrote: So, I'm writing a mojo where (for various strange reasons) I need to construct and resolve Artifacts manually, during mojo execution. My first attempt at the code looked something like: Artifact a = artifactFactory.createDependencyArtifact(...); artifactResolver.resolve(a, ...); This works beautifully, so long as you supply the ArtifactFactory with a /definite/ version number. If you attempt to use a version range or a keyword like RELEASE, LATEST, etc, everything blows up. From reading through the source code, the resolve() method is expecting the artifact to already have a definite version number. (There's a shortcut optimization to look directly inside the local repository before triggering a download.) So my question is, what am I doing wrong here? How do I trigger Maven's code for locating the most appropriate version given a range/keyword/etc? Is there a helper or utility class for all of this somewhere? --Matthew Beermann __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]