In the meantime I had a look and found out that I can get the path for the 
local artifact:
session.getRepositorySession().getLocalRepositoryManager().getPathForLocalArtifact(artifact);
As for the Artifact I can use the DefaultArtifact.
In that folder also the POM of the artifact should reside as it is also 
downloaded normally.
But as I use a Nexus repository management I had to realize that the content of 
that POM is very different to the POM of the original artifact.

E.g. log4j-1.2.13, local:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.13</version>
  <description>POM was created by Sonatype Nexus</description>
</project>

Original (using search.maven.org):

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.13</version>
  <packaging>jar</packaging>
  <name>Log4j</name>
  <url>http://logging.apache.org/log4j/docs/</url>
  <description>Log4j</description>
  <scm>
    <url>http://svn.apache.org/viewcvs.cgi/logging/log4j/tags/v1_2_13/</url>
  </scm>
</project>

For some reason Nexus doesn't provide the original POM, beat me why.

So I'm not really closer to a solution for my problem...

Regards,
Gerrit

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Gesendet: Donnerstag, 7. Juni 2018 09:46
An: [email protected]
Betreff: Maven plug-in development: Obtaining name of artifact

Hello everyone, :-)

 

I'm currently writing a Maven plug-in and I have the coordinates of
artifacts (groupId, artifactId, version), but I need the names of the
artifacts.

Is there an easy way to get them (within my plug-in without relying on
other plug-ins)?

 

Regards,

Gerrit

 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to