Skip to content

Commit

Permalink
Use the effective Maven project build config when initializing source…
Browse files Browse the repository at this point in the history
…s and classes paths for dev mode
  • Loading branch information
aloubyansky committed Feb 11, 2023
1 parent 6da5320 commit 40c3a73
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ static Map<Path, Model> getProjectMap(MavenSession session) {
}
final Map<Path, Model> projectModels = new HashMap<>(allProjects.size());
for (MavenProject mp : allProjects) {
mp.getOriginalModel().setPomFile(mp.getFile());
projectModels.put(mp.getBasedir().toPath(), mp.getOriginalModel());
final Model model = mp.getOriginalModel();
model.setPomFile(mp.getFile());
// activated profiles or custom extensions may have overridden the build defaults
model.setBuild(mp.getModel().getBuild());
projectModels.put(mp.getBasedir().toPath(), model);
}
return projectModels;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public WorkspaceModule toWorkspaceModule(BootstrapMavenContext ctx) {
DefaultArtifactSources src = null;
if (e.getGoals().contains(ArtifactCoords.TYPE_JAR)) {
src = processJarPluginExecutionConfig(e.getConfiguration(), false);
addDefaultSourceSet &= !e.getId().equals("default-jar");
addDefaultSourceSet &= !(src != null && e.getId().equals("default-jar"));
} else if (e.getGoals().contains("test-jar")) {
src = processJarPluginExecutionConfig(e.getConfiguration(), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ private LocalProject loadAndCacheProject(Path pomFile) throws BootstrapMavenExce
}

private Model rawModel(Path pomFile) throws BootstrapMavenException {
Model rawModel = rawModelCache.getOrDefault(pomFile.getParent(),
modelProvider == null ? null : modelProvider.apply(pomFile.getParent()));
final Path moduleDir = pomFile.getParent();
Model rawModel = rawModelCache.get(moduleDir);
if (rawModel != null) {
return rawModel;
}
rawModel = modelProvider == null ? null : modelProvider.apply(moduleDir);
if (rawModel == null) {
rawModel = readModel(pomFile);
}
rawModelCache.put(pomFile.getParent(), rawModel);
rawModelCache.put(moduleDir, rawModel);
return rawModel;
}

Expand Down

0 comments on commit 40c3a73

Please sign in to comment.