Skip to content

Commit

Permalink
Take micronaut-platform into consideration in sanity check (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
melix authored Nov 24, 2022
1 parent c5e8c6b commit 1712c69
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void importMicronautCatalogFromGAV(String gavCoordinates) {
List<String> parts = Arrays.asList(gavCoordinates.split(":"));
String groupId = parts.get(0);
String artifactId = parts.get(1);
if ("micronaut-bom".equals(groupId) && "micronaut-bom".equals(artifactId)) {
if (isMicronautPlatform(groupId, artifactId)) {
throw new IllegalStateException("Projects must not import the platform BOM or it would create a cyclic dependency. Please use the core BOM instead.");
}
if (parts.size() == 3) {
Expand All @@ -156,6 +156,11 @@ public void importMicronautCatalogFromGAV(String gavCoordinates) {
});
}

private static boolean isMicronautPlatform(String groupId, String artifactId) {
return ("micronaut-bom".equals(groupId) && "micronaut-bom".equals(artifactId)) ||
("micronaut-platform".equals(groupId) && "micronaut-platform".equals(artifactId));
}

/**
* Exposes a Micronaut version catalog so that
* it can be used in modules using type safe accessors.
Expand Down Expand Up @@ -187,7 +192,7 @@ public void importMicronautCatalog(String alias) {
List<String> parts = Arrays.asList(gavCoordinates.split(":"));
String groupId = parts.get(0);
String artifactId = parts.get(1);
if ("micronaut-bom".equals(groupId) && "micronaut-bom".equals(artifactId)) {
if (isMicronautPlatform(groupId, artifactId)) {
throw new IllegalStateException("Projects must not import the platform BOM or it would create a cyclic dependency. Please use the core BOM instead.");
}
if (parts.size() == 3) {
Expand Down

0 comments on commit 1712c69

Please sign in to comment.