mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Merge pull request #7287 from aloubyansky/7195
Bootstrap/workspace discovery: check parent dir for pom.xml
This commit is contained in:
@@ -80,25 +80,20 @@ public class LocalProject {
|
||||
|
||||
private static Model loadRootModel(Path currentProjectDir) throws BootstrapException {
|
||||
Path pomXml = currentProjectDir.resolve(POM_XML);
|
||||
Model model = readModel(pomXml);
|
||||
Parent parent = model.getParent();
|
||||
while (parent != null) {
|
||||
if (parent.getRelativePath() != null && !parent.getRelativePath().isEmpty()) {
|
||||
Model model = null;
|
||||
while (Files.exists(pomXml)) {
|
||||
model = readModel(pomXml);
|
||||
final Parent parent = model.getParent();
|
||||
if (parent != null
|
||||
&& parent.getRelativePath() != null
|
||||
&& !parent.getRelativePath().isEmpty()) {
|
||||
pomXml = pomXml.getParent().resolve(parent.getRelativePath()).normalize();
|
||||
if (!Files.exists(pomXml)) {
|
||||
return model;
|
||||
}
|
||||
if (Files.isDirectory(pomXml)) {
|
||||
pomXml = pomXml.resolve(POM_XML);
|
||||
}
|
||||
} else {
|
||||
pomXml = pomXml.getParent().getParent().resolve(POM_XML);
|
||||
if (!Files.exists(pomXml)) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
model = readModel(pomXml);
|
||||
parent = model.getParent();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -107,10 +107,10 @@ public class LocalWorkspaceDiscoveryTest {
|
||||
assertEquals("independent", project.getArtifactId());
|
||||
assertEquals(MvnProjectBuilder.DEFAULT_VERSION, project.getVersion());
|
||||
final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects();
|
||||
assertEquals(1, projects.size());
|
||||
assertEquals(6, projects.size());
|
||||
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "independent")));
|
||||
|
||||
assertLocalDeps(project);
|
||||
assertLocalDeps(project, "root-module-not-direct-child", "root-no-parent-module", "root-module-with-parent");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -135,9 +135,9 @@ public class LocalWorkspaceDiscoveryTest {
|
||||
assertEquals(MvnProjectBuilder.DEFAULT_VERSION, project.getVersion());
|
||||
assertNotNull(project.getWorkspace());
|
||||
final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects();
|
||||
assertEquals(1, projects.size());
|
||||
assertEquals(5, projects.size());
|
||||
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-no-parent-module")));
|
||||
assertLocalDeps(project);
|
||||
assertLocalDeps(project, "root-module-not-direct-child");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user