Skip to content

Commit

Permalink
Check GAV in relocation
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Oct 22, 2024
1 parent f3af6c6 commit d725aac
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.maven.model.License;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Relocation;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.project.MavenProject;

Expand Down Expand Up @@ -154,9 +155,9 @@ public static void check(Logger log, MavenProject project, Configuration configu
errors.add("<version> contains an unresolved expression: " + fullModel.getVersion());
}
if (isRelocated(fullModel)) {
log.debug("Checking <distributionManagement>/<relocation>/<groupId>");
if (isBlank(fullModel.getDistributionManagement().getRelocation().getGroupId())) {
errors.add("<distributionManagement>/<relocation>/<groupId> can not be blank.");
Relocation relocation = fullModel.getDistributionManagement().getRelocation();
if (isBlank(relocation.getGroupId()) && isBlank(relocation.getArtifactId()) && isBlank(relocation.getVersion())) {
errors.add("<distributionManagement>/<relocation> requires either <groupId>, <artifactId> or <version>.");
}
} else {
log.debug("Checking <name>");
Expand Down

0 comments on commit d725aac

Please sign in to comment.