Skip to content

Commit

Permalink
Last nit
Browse files Browse the repository at this point in the history
If pom A and project A has same coordinates, BUT the project A
has file set, use that instead.
  • Loading branch information
cstamas committed Jan 12, 2024
1 parent edf88f0 commit 57cca66
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/org/apache/maven/plugins/install/InstallMojo.java
Expand Up @@ -196,19 +196,22 @@ private void processProject(MavenProject project, InstallRequest request) throws
// incomplete project: is not pom project and projectArtifact has no file

// we must compare coordinates ONLY (as projectArtifact may not have file, and Artifact.equals factors it in)
boolean pomArtifactIsMainArtifact = ArtifactIdUtils.equalsId(pomArtifact, projectArtifact);
if (pomArtifactIsMainArtifact) {
// BUT if projectArtifact has file set, use that one
if (ArtifactIdUtils.equalsId(pomArtifact, projectArtifact)) {
if (isFile(projectArtifact.getFile())) {
pomArtifact = projectArtifact;
}
projectArtifact = null;
}
// is not packaged, is "incomplete"
boolean isIncomplete = projectArtifact != null && !isFile(projectArtifact.getFile());

if (isFile(pomArtifact.getFile())) {
request.addArtifact(pomArtifact);
} else {
throw new MojoExecutionException("The project POM could not be attached");
}

// is not packaged, is "incomplete"
boolean isIncomplete = projectArtifact != null && !isFile(projectArtifact.getFile());
if (projectArtifact != null) {
if (!isIncomplete) {
request.addArtifact(projectArtifact);
Expand Down

0 comments on commit 57cca66

Please sign in to comment.