gnodet-bot commented on code in PR #14133:
URL: https://github.com/apache/maven/pull/14133#discussion_r4708531428
##########
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java:
##########
@@ -43,74 +43,148 @@
import org.apache.maven.api.model.Profile;
import org.apache.maven.impl.MappedCollection;
import org.apache.maven.impl.MappedList;
+import org.apache.maven.impl.MutableProject;
+import org.apache.maven.model.root.RootLocator;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.SourceQueries;
import org.apache.maven.project.artifact.ProjectArtifact;
import org.eclipse.aether.util.artifact.ArtifactIdUtils;
+import static java.util.Objects.requireNonNull;
+
public class DefaultProject implements Project {
private final InternalMavenSession session;
- private final MavenProject project;
+ private final String groupId;
+ private final String artifactId;
+ private final String version;
private final Packaging packaging;
+ private final List<org.eclipse.aether.artifact.Artifact> artifacts;
+ private final boolean producesMainArtifact;
+ private final Model model;
+ private final Path pomPath;
+ private final Path basedir;
+ private final Path rootDirectory;
+ private final Project parent;
+ private final List<Profile> effectiveProfiles;
+ private final List<Profile> declaredActiveProfiles;
+ private final List<Profile> effectiveActiveProfiles;
+ private final MutableProject mutableProject;
public DefaultProject(InternalMavenSession session, MavenProject project) {
- this.session = session;
- this.project = project;
+ this(session, project, null);
+ }
+
+ private DefaultProject(InternalMavenSession session, MavenProject project,
MutableProject mutableProject) {
Review Comment:
This constructor copies state *from* `MavenProject` into immutable fields,
making `MavenProject` the source of truth and `DefaultProject` a snapshot of it.
The target design from #13461 is the reverse: `MavenProject` should be a
thin façade that reads through `MutableProject`, and `DefaultProject` should
hold v4 types natively with no reference back to `MavenProject`. See review
body for the full proposed fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]