modify artifact file path
@@ -46,7 +46,6 @@ import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.VersionRangeRequest;
import org.eclipse.aether.resolution.VersionRangeResolutionException;
import org.eclipse.aether.resolution.VersionRangeResult;
-
/**
* Liberty Abstract Mojo Support
*
@@ -419,8 +418,17 @@ public abstract class AbstractLibertySupport extends MojoSupport {
Artifact artifact = new DefaultArtifact(item.getGroupId(), item.getArtifactId(), item.getVersion(),
Artifact.SCOPE_PROVIDED, item.getType(), null, new DefaultArtifactHandler("jar"));
+
if (artifactFile != null && artifactFile.exists()) {
+ String pathToLocalArtifact = this.repoSession.getLocalRepositoryManager().getPathForLocalArtifact(aetherArtifact);
+ File localArtifactFile = new File (this.artifactRepository.getBasedir() ,pathToLocalArtifact);
+
+ //sometimes variable artifactFile has a path of a build output folder(target). Setting the artifact file path that corresponds to Maven coord.
+ if(localArtifactFile.exists()) {
+ artifact.setFile(localArtifactFile);
+ }else {
artifact.setFile(artifactFile);
+ }
artifact.setResolved(true);
log.debug(item.getGroupId() + ":" + item.getArtifactId() + ":" + item.getVersion()
+ " is resolved from project repositories.");
