build: scope private repository to legacy xinda
This commit is contained in:
@@ -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<String> profileRepositoryIds(Document pom, String profileId) {
|
||||
Element profile = profile(pom, profileId);
|
||||
if (profile == null) {
|
||||
return List.of();
|
||||
}
|
||||
return repositoryIds(profile);
|
||||
}
|
||||
|
||||
private static List<String> repositoryIds(Element owner) {
|
||||
Element repositories = firstDirectChild(owner, "repositories");
|
||||
if (repositories == null) {
|
||||
return List.of();
|
||||
}
|
||||
List<String> 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) {
|
||||
|
||||
37
pom.xml
37
pom.xml
@@ -112,6 +112,24 @@
|
||||
<module>modules/inbound/inbound-xinda-push</module>
|
||||
<module>modules/apps/xinda-push-app</module>
|
||||
</modules>
|
||||
<!--
|
||||
羚牛私仓:托管 legacy Xinda 依赖 org.lingniu:gps-push-client:1.0。
|
||||
访问凭证配置在 ~/.m2/settings.xml 的 <server><id>lingniu-nexus</id></server> 中,
|
||||
pom 不保存明文密码。默认生产 reactor 不需要访问该私仓。
|
||||
-->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>lingniu-nexus</id>
|
||||
<name>Lingniu Private Maven Repository</name>
|
||||
<url>https://nexus.lnh2e.com/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -370,25 +388,6 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<!--
|
||||
羚牛私仓:托管 org.lingniu:gps-push-client:1.0 等内部 artifact。
|
||||
访问凭证配置在 ~/.m2/settings.xml 的 <server><id>lingniu-nexus</id></server> 中,
|
||||
pom 不保存明文密码。
|
||||
-->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>lingniu-nexus</id>
|
||||
<name>Lingniu Private Maven Repository</name>
|
||||
<url>https://nexus.lnh2e.com/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
Reference in New Issue
Block a user