Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B42F710363 for ; Fri, 8 Nov 2013 10:46:26 +0000 (UTC) Received: (qmail 39705 invoked by uid 500); 8 Nov 2013 10:45:51 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 39635 invoked by uid 500); 8 Nov 2013 10:45:43 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 39625 invoked by uid 99); 8 Nov 2013 10:45:39 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Nov 2013 10:45:39 +0000 Received: from localhost (HELO mail-wg0-f50.google.com) (127.0.0.1) (smtp-auth username olamy, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Nov 2013 10:45:39 +0000 Received: by mail-wg0-f50.google.com with SMTP id k14so141826wgh.17 for ; Fri, 08 Nov 2013 02:45:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ApiXmYT4EfVUVPLcO322/IzZdJkFlMnr4vpjinKCL80=; b=RSMG75CIKPdroQge+q6sJ9S01nG31jsWzTdh13VxN87PrWMhS1ktKXYvCpnALpElTJ 8jGrb3dSluwLiJa4qKOyh8e6JF/osI2qO2Ilk/5nD6Qy7I21Lu1zoZ9BwI1/v7dibqla DMq79BZprZEFNXqibzG1Hn0g/EnflaEf/Gl500xOvuJn7AO8F8HIqRRwc6ZExod2mv6i V2Og2kXj4gpU2Pmu5K34dKo0GoB0gQR1ES93uZEVTMCh+HvExKkubBxlls3bPE2N8CpP /UVrjucIAFQmAZ1Mjgc9N0rzpdeDogWunV22JkF022CKEnTr57yr5BkC9Ju6YITVjT6e TVGw== X-Received: by 10.180.221.38 with SMTP id qb6mr1856275wic.8.1383907537806; Fri, 08 Nov 2013 02:45:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.120.66 with HTTP; Fri, 8 Nov 2013 02:45:17 -0800 (PST) In-Reply-To: References: From: Olivier Lamy Date: Fri, 8 Nov 2013 21:45:17 +1100 Message-ID: Subject: Re: Plugin, how to resolve single dependency To: Maven Users List Content-Type: text/plain; charset=ISO-8859-1 If the idea is to resolve an artifact when you know groupId:artifactId:version[:type:classifier] Try @Component protected ArtifactResolver resolver; @Component protected ArtifactFactory artifactFactory; @Parameter(property = "localRepository", readonly = true) protected ArtifactRepository localRepository; @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true ) protected List remoteRepositories; protected Artifact resolve( String groupId, String artifactId, String version, String type, String classifier ) throws MojoExecutionException { Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); resolver.resolve(artifact, remoteRepositories, localRepository); return artifact; } On 8 November 2013 21:05, Stephen Colebourne wrote: > Any thoughts on this? > Stephen > > On 6 November 2013 12:37, Stephen Colebourne wrote: >> I have a plugin that needs to access just one dependency from the project. >> >> Currently I use "@requiresDependencyResolution compile" and build the >> entire classpath: >> https://github.com/JodaOrg/joda-beans-maven-plugin/blob/master/src/main/java/org/joda/beans/maven/AbstractJodaBeansMojo.java#L213 >> >> This is far from ideal as it requires the whole codebase that the >> plugin is used on to compile, which is hard given that it is a code >> generator... >> >> It looks like @requiresDependencyCollection might be what I need, but >> what steps must I take to find the actual dependency I want and then >> resolve just that one into a classpath? >> >> Feel free to examine the plugin: >> https://github.com/JodaOrg/joda-beans-maven-plugin/blob/master/src/main/java/org/joda/beans/maven >> >> thanks >> Stephen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org > For additional commands, e-mail: users-help@maven.apache.org > -- Olivier Lamy Ecetera: http://ecetera.com.au http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org