nicolas de loof-3 wrote:
>
> I can build the plugin artifact :Artifact pluginArtifact =
> embedder.createArtifact( plugin.getGroupId(),
> plugin.getArtifactId(), plugin.getVersion(),
> Artifact.SCOPE_RUNTIME, "maven-plugin" );
>
> then get the declared dependencies :
> List dependencies = plugin.getDependencies();
>
> Then build a URLClassLoader to get the resource URL
> URL[] urls = new URL[] { ... };
> ClassLoader classLoader = new URLClassLoader( urls );
> URL url = classLoader.getResource( configLocation.getValue() );
>
That is not right.First of all createArtifact() does not download any jars.
You need to use MavenEmbedder.resolve() method to get jars downloaded.
However it is not going to help you with dependencies, because
plugin.getDependencies(); will return model dependencies (stuff that is
declared in pom.xml where plugin is used, but it does not include
dependencies declared in plugin's own pom (and its parent).
nicolas de loof-3 wrote:
>
> But as you suggested, this code allready exists somewhere in maven !
>
> I also don't know how to get dependencies from pluginArtifact : how to
> build
> a mavenProject from it to get mavenProject.getArtifacts() ?
>
You can use MavenEmbedder.readProjectWithDependencies() to get MavenProject
for the plugin's pom. But even that won't handle artifacts declared in
plugin/dependencies (including stuff decalred somewhere else in
plugin/dependencyManagement).
regards,
Eugene
--
View this message in context:
http://www.nabble.com/m2eclipse-checkstyle-support-tp20357992p20364918.html
Sent from the Maven Developers mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]