I try to make some maven plugin. I need to get path for artifact and pom.xml just after install phase. I got artifact path like this:
D:\Work\test\mvn\moduleFirst\target\first-1.0-SNAPSHOT.jar
And pom.xml path like this:
D:\Work\test\mvn\moduleFirst\pom.xml
But if in pom.xml package are set “pom”, then I got artifact path like this:
C:\Users\user.m2\repository\com\test\mvn\1.0-SNAPSHOT\mvn-1.0-SNAPSHOT.pom
And pom.xml:
D:\Work\test\mvn\pom.xml
I’d like get all path from .m2 local repo. How it possible?
I make follow code:
...
/**
* @parameter default-value="${project.file}"
*/
private File pomFile;
...
/**
* @parameter default-value="${project.artifact}"
*/
private Artifact artifact;
...
public void execute() throws MojoExecutionException {
...
getLog().info("POM file " + pomFile.getAbsolutePath());
getLog().info("Artifact " + artifact.getFile().getAbsolutePath());
...
}
I found the solution.
Thanks to maven-install-plugin 🙂