diff --git a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java index ff75478d..d8545e43 100644 --- a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java +++ b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java @@ -122,6 +122,16 @@ class MavenModuleProfileTest { "modules/apps/xinda-push-app"); } + @Test + void privateLingniuRepositoryIsScopedToLegacyXindaProfile() throws Exception { + Document pom = rootPom(); + + assertThat(repositoryIds(pom.getDocumentElement())) + .doesNotContain("lingniu-nexus"); + assertThat(profileRepositoryIds(pom, "legacy-xinda")) + .containsExactly("lingniu-nexus"); + } + @Test void optionalModuleVersionsAreScopedToTheirProfiles() throws Exception { Document pom = rootPom(); @@ -423,6 +433,33 @@ class MavenModuleProfileTest { return dependencyManagementArtifacts(profile); } + private static List profileRepositoryIds(Document pom, String profileId) { + Element profile = profile(pom, profileId); + if (profile == null) { + return List.of(); + } + return repositoryIds(profile); + } + + private static List repositoryIds(Element owner) { + Element repositories = firstDirectChild(owner, "repositories"); + if (repositories == null) { + return List.of(); + } + List ids = new ArrayList<>(); + NodeList children = repositories.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + if (!(children.item(i) instanceof Element repository) || !"repository".equals(repository.getTagName())) { + continue; + } + Element id = firstDirectChild(repository, "id"); + if (id != null) { + ids.add(id.getTextContent().trim()); + } + } + return List.copyOf(ids); + } + private static Element profile(Document pom, String profileId) { Element profiles = firstDirectChild(pom.getDocumentElement(), "profiles"); if (profiles == null) { diff --git a/pom.xml b/pom.xml index ce99a6c5..61f1ab0c 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,24 @@ modules/inbound/inbound-xinda-push modules/apps/xinda-push-app + + + + lingniu-nexus + Lingniu Private Maven Repository + https://nexus.lnh2e.com/repository/maven-public/ + + true + + + true + + + @@ -370,25 +388,6 @@ - - - - lingniu-nexus - Lingniu Private Maven Repository - https://nexus.lnh2e.com/repository/maven-public/ - - true - - - true - - - -