You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Henrik Eriksson <he...@gmail.com> on 2013/02/01 00:10:05 UTC

Listing all attached artifacts for a specific GAV

Hello.

I'm writing a plugin and I'm wondering if there is any way of retrieving an
artifact's attached artifacts in a repository. I know the main artifact but
like to get the attached ones too. There are several workarounds for this,
but I would like to find out if there is a better way. I have been
searching the APIs and documentation but haven't yet found a nice way of
doing it. The reason of doing this is because I'd like to so you don't need
to declare them in a pom.

Example:
com.acme.comp:artifact:ear:1.0 <-- main artifact
com.acme.comp:artifact:attachment1:xml <-- attachment which I'd like to get
programmatically without knowing the classifier name.

TIA
Henrik

Re: Listing all attached artifacts for a specific GAV

Posted by Henrik Eriksson <he...@gmail.com>.
Hello.
Thank you for your reply. Well there is some sort of data about it in a
local repository, not sure about what ends up in a remote one. I'm aware of
that the artifact should declare the dependencies, and that was one of the
ideas I had, though right now its pretty much impossible to do so due to
other circumstances. For now I just settled to declare the main artifacts
and look for them in a local repository. In our environment remote
deployments are not utilized, so I don't have to look for it elsewhere .
Pity though there is no "bulk" lookup feature, atleast for the same GAV.

On the other hand updating a pom file during a build with new dependencies
could set off the build entierly, wouldn't it?


2013/2/1 Anders Hammar <an...@hammar.net>

> Don't think this is possible simply because the metadata about attached
> artifacts doesn't exist.
>
> Please also note that all direct dependencies should be declared in the
> pom. So if you're going to deploy to a repo your plugin needs to update the
> pom-to-be-deployed and add this info. If you don't, any build declaring a
> dependency to your artifact will fail because the dependency info is
> missing.
>
> /Anders
>
>
> On Fri, Feb 1, 2013 at 12:10 AM, Henrik Eriksson <
> henrikeriksson75@gmail.com
> > wrote:
>
> > Hello.
> >
> > I'm writing a plugin and I'm wondering if there is any way of retrieving
> an
> > artifact's attached artifacts in a repository. I know the main artifact
> but
> > like to get the attached ones too. There are several workarounds for
> this,
> > but I would like to find out if there is a better way. I have been
> > searching the APIs and documentation but haven't yet found a nice way of
> > doing it. The reason of doing this is because I'd like to so you don't
> need
> > to declare them in a pom.
> >
> > Example:
> > com.acme.comp:artifact:ear:1.0 <-- main artifact
> > com.acme.comp:artifact:attachment1:xml <-- attachment which I'd like to
> get
> > programmatically without knowing the classifier name.
> >
> > TIA
> > Henrik
> >
>

Re: Listing all attached artifacts for a specific GAV

Posted by Anders Hammar <an...@hammar.net>.
Don't think this is possible simply because the metadata about attached
artifacts doesn't exist.

Please also note that all direct dependencies should be declared in the
pom. So if you're going to deploy to a repo your plugin needs to update the
pom-to-be-deployed and add this info. If you don't, any build declaring a
dependency to your artifact will fail because the dependency info is
missing.

/Anders


On Fri, Feb 1, 2013 at 12:10 AM, Henrik Eriksson <henrikeriksson75@gmail.com
> wrote:

> Hello.
>
> I'm writing a plugin and I'm wondering if there is any way of retrieving an
> artifact's attached artifacts in a repository. I know the main artifact but
> like to get the attached ones too. There are several workarounds for this,
> but I would like to find out if there is a better way. I have been
> searching the APIs and documentation but haven't yet found a nice way of
> doing it. The reason of doing this is because I'd like to so you don't need
> to declare them in a pom.
>
> Example:
> com.acme.comp:artifact:ear:1.0 <-- main artifact
> com.acme.comp:artifact:attachment1:xml <-- attachment which I'd like to get
> programmatically without knowing the classifier name.
>
> TIA
> Henrik
>