Skip to content

Commit

Permalink
Reload pom contents as needed before finding parent POMs (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
testforstephen authored Jan 31, 2024
1 parent 9305308 commit 8ee1ef0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/archetype/createProject/SelectParentPomStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ export class SelectParentPom implements IProjectCreationStep {
}
];
MavenProjectManager.projects
.filter(project => project.artifactId && project.pomPath && pathExistsSync(project.pomPath))
.filter(project => project.pomPath && pathExistsSync(project.pomPath))
.map(project => {
if (!project.artifactId) {
// reload pom contents
project.parsePom();
}

return project;
})
.filter(project => project.artifactId && project.groupId)
.sort((a, b) => a.pomPath.length - b.pomPath.length)
.forEach(project => {
items.push({
Expand Down
4 changes: 3 additions & 1 deletion src/project/MavenProjectManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export class MavenProjectManager {
}

public static add(pomPath: string): void {
MavenProjectManager.getInstance()._projectMap.set(pomPath, new MavenProject(pomPath));
const newProject = new MavenProject(pomPath);
newProject.parsePom();
MavenProjectManager.getInstance()._projectMap.set(pomPath, newProject);
}

public static remove(pomPath: string): void {
Expand Down

0 comments on commit 8ee1ef0

Please sign in to comment.