You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Detlef Pleiss <d....@comundus.com> on 2006/05/22 15:37:08 UTC

retrieving path in local repository from within a plugin

Hi,

as the plugin developer list over at codehaus seems to be down, I hope to
get an answer here:

I want to get the full absolute path to some artifact in the local
repository. So what I want is:
input: groupId, artifactId, version
output: absolute path to that artifact in local repository
For reasons not to be explained here, the plugin can not have
@requiresDependencyResolution set and can not have the wanted artifact in
its dependencies in the POM.

Does the Maven API offer such a function for use inside of a plugin?
What I currently do and what works is having a parameter with
     * @parameter
expression="${settings.localRepository}/<groupId>/<artifactId>/<version>/<ar
tifactId>-<version>.jar"
(fill in <groupId>, <artifactId>, <version> with the appropriate values)
It works, but does not look like a clean way to me as it involves knowledge
about the inner structure of the local repository, which might be subject to
change.

A surplus would be to have a way to get this artifact downloaded if it's not
present - but remember, without having to add it to the POM.


thanks in advance!
greetings,

Mit freundlichen Grüßen

i.A. Detlef Pleiß
________________________________________________________________

Mit einem Klick alles im Blick, dank Informatik
Partner im Wissenschaftsjahr 2006 – www.Informatikjahr.de
________________________________________________________________

Datenverarbeitungskaufmann
Detlef Pleiß


Senior IT-Berater

comundus GmbH
Schüttelgrabenring 3, 71332 Waiblingen

Telefon  +49 (0)71 51-5 00 28-22
Internet www.comundus.com

IT EXCELLENCE by comundus.
________________________________________________________________



AW: retrieving path in local repository from within a plugin

Posted by Detlef Pleiss <d....@comundus.com>.
thanks, Kenney and Brian, I got it to work.


Mit freundlichen Grüßen 

i.A. Detlef Pleiß 
________________________________________________________________

Mit einem Klick alles im Blick, dank Informatik
Partner im Wissenschaftsjahr 2006 – http://www.informatikjahr.de 
________________________________________________________________

Datenverarbeitungskaufmann 
Detlef Pleiß 


Senior IT-Berater 

comundus GmbH 
Schüttelgrabenring 3, 71332 Waiblingen 

Telefon  +49 (0)71 51-5 00 28-22
Internet http://www.comundus.com  

IT EXCELLENCE by comundus. 
________________________________________________________________ 




-----Ursprüngliche Nachricht-----
Von: Kenney Westerhof [mailto:kenney@apache.org]
Gesendet: Montag, 22. Mai 2006 17:17
An: Maven Developers List
Betreff: Re: retrieving path in local repository from within a plugin


On Mon, 22 May 2006, Detlef Pleiss wrote:

Hi,

Why don't you just specify that dependency in the plugin's
pom? Or let the users specify it in a <dependencies> section in the
<plugin> section in their pom?

There is a way to do this however, but it's strongly discouraged because
it should be Maven's job to handle dependencies and configuring the
runtime environment. That said: take a look at the maven-eclipse-plugin's
usage of the ArtifactManager..

See
https://svn.apache.org/repos/asf/maven/components/trunk/maven-artifact-manager

It can download artifacts and give you the filename.

-- Kenney


> Hi,
>
> as the plugin developer list over at codehaus seems to be down, I hope to
> get an answer here:
>
> I want to get the full absolute path to some artifact in the local
> repository. So what I want is:
> input: groupId, artifactId, version
> output: absolute path to that artifact in local repository
> For reasons not to be explained here, the plugin can not have
> @requiresDependencyResolution set and can not have the wanted artifact in
> its dependencies in the POM.
>
> Does the Maven API offer such a function for use inside of a plugin?
> What I currently do and what works is having a parameter with
>      * @parameter
> expression="${settings.localRepository}/<groupId>/<artifactId>/<version>/<ar
> tifactId>-<version>.jar"
> (fill in <groupId>, <artifactId>, <version> with the appropriate values)
> It works, but does not look like a clean way to me as it involves knowledge
> about the inner structure of the local repository, which might be subject to
> change.
>
> A surplus would be to have a way to get this artifact downloaded if it's not
> present - but remember, without having to add it to the POM.
>
>
> thanks in advance!
> greetings,
>
> Mit freundlichen Gren
>
> i.A. Detlef Plei
> ________________________________________________________________
>
> Mit einem Klick alles im Blick, dank Informatik
> Partner im Wissenschaftsjahr 2006  www.Informatikjahr.de
> ________________________________________________________________
>
> Datenverarbeitungskaufmann
> Detlef Plei
>
>
> Senior IT-Berater
>
> comundus GmbH
> Schttelgrabenring 3, 71332 Waiblingen
>
> Telefon  +49 (0)71 51-5 00 28-22
> Internet www.comundus.com
>
> IT EXCELLENCE by comundus.
> ________________________________________________________________
>
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: retrieving path in local repository from within a plugin

Posted by Kenney Westerhof <ke...@apache.org>.
On Mon, 22 May 2006, Detlef Pleiss wrote:

Hi,

Why don't you just specify that dependency in the plugin's
pom? Or let the users specify it in a <dependencies> section in the
<plugin> section in their pom?

There is a way to do this however, but it's strongly discouraged because
it should be Maven's job to handle dependencies and configuring the
runtime environment. That said: take a look at the maven-eclipse-plugin's
usage of the ArtifactManager..

See
https://svn.apache.org/repos/asf/maven/components/trunk/maven-artifact-manager

It can download artifacts and give you the filename.

-- Kenney


> Hi,
>
> as the plugin developer list over at codehaus seems to be down, I hope to
> get an answer here:
>
> I want to get the full absolute path to some artifact in the local
> repository. So what I want is:
> input: groupId, artifactId, version
> output: absolute path to that artifact in local repository
> For reasons not to be explained here, the plugin can not have
> @requiresDependencyResolution set and can not have the wanted artifact in
> its dependencies in the POM.
>
> Does the Maven API offer such a function for use inside of a plugin?
> What I currently do and what works is having a parameter with
>      * @parameter
> expression="${settings.localRepository}/<groupId>/<artifactId>/<version>/<ar
> tifactId>-<version>.jar"
> (fill in <groupId>, <artifactId>, <version> with the appropriate values)
> It works, but does not look like a clean way to me as it involves knowledge
> about the inner structure of the local repository, which might be subject to
> change.
>
> A surplus would be to have a way to get this artifact downloaded if it's not
> present - but remember, without having to add it to the POM.
>
>
> thanks in advance!
> greetings,
>
> Mit freundlichen Gr��en
>
> i.A. Detlef Plei�
> ________________________________________________________________
>
> Mit einem Klick alles im Blick, dank Informatik
> Partner im Wissenschaftsjahr 2006 � www.Informatikjahr.de
> ________________________________________________________________
>
> Datenverarbeitungskaufmann
> Detlef Plei�
>
>
> Senior IT-Berater
>
> comundus GmbH
> Sch�ttelgrabenring 3, 71332 Waiblingen
>
> Telefon  +49 (0)71 51-5 00 28-22
> Internet www.comundus.com
>
> IT EXCELLENCE by comundus.
> ________________________________________________________________
>
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org