Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Determining the GAV of poms in remote repository

Samuel Cox wrote:

I posted the following to the Maven mailing list, but I'm guessing this
list is more appropriate.  Essentially, what I need is the following
function:

gav(File settingsXml, File pom) => GAV coordinates

Aether is about artifacts and repositories, not pom.xml or settings.xml reading. So this mailing list is not the appropriate place to ask about Maven-specific functionality.

I'm writing a standalone program that needs to find the GAV coordinates for
a Maven pom file, which is retrieved from Subversion.  In the simple case,
this is easy.  I just parse the pom.  However, things get much more
complicated when only the artifactId is present.

Is this possible?  It seems like it should be since Maven can build the
project if I check it out (presumably by resolving all the parent stuff).

For any well-maintained POM file, its GAV can be determined from just that file, either from project.groupId|artifactId|version or from project.parent.groupId|artifactId|version if former values are omitted.

Maven itself uses DefaultProjectBuilder, DefaultSettingsBuilder and a couple other components to build the full MavenProject instance. Details about said components can be asked on the Maven mailing lists or just gleaned from Maven's source code.


Benjamin


Back to the top