maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven] rfscholte commented on a change in pull request #373: [MNG-6118] submodule invocation
Date Fri, 09 Oct 2020 14:06:34 GMT

rfscholte commented on a change in pull request #373:
URL: https://github.com/apache/maven/pull/373#discussion_r502365260



##########
File path: maven-core/src/main/java/org/apache/maven/graph/ProjectlessCollectionStrategy.java
##########
@@ -0,0 +1,67 @@
+package org.apache.maven.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.DefaultMaven;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.model.building.UrlModelSource;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingRequest;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Strategy to collect projects for building when the Maven invocation is not in a folder
that contains a pom.xml.
+ */
+@Named( "ProjectlessCollectionStrategy" )

Review comment:
       `PomlessCollectionStrategy` I guess, because e.g. `help:system` can be executed anywhere,
it will provide the standalone project.

##########
File path: maven-core/src/main/java/org/apache/maven/graph/ProjectCollectionStrategy.java
##########
@@ -0,0 +1,41 @@
+package org.apache.maven.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+
+import java.util.List;
+
+/**
+ * Describes strategies for finding projects that Maven could build.
+ */
+public interface ProjectCollectionStrategy
+{
+    /**
+     *
+     * @param request
+     * @return
+     * @throws ProjectBuildingException
+     */
+    List<MavenProject> collectProjects( final MavenExecutionRequest request )
+            throws ProjectBuildingException;

Review comment:
       Shouldn't this be an exception in the same package?

##########
File path: maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##########
@@ -71,15 +63,23 @@
 public class DefaultGraphBuilder
     implements GraphBuilder
 {
+    private final Logger logger = LoggerFactory.getLogger( getClass() );

Review comment:
       private static final Logger logger = LoggerFactory.getLogger( DefaultGraphBuilder.class
);

##########
File path: maven-core/src/main/java/org/apache/maven/graph/DefaultProjectsCollector.java
##########
@@ -0,0 +1,99 @@
+package org.apache.maven.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProblemUtils;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.io.File;
+import java.util.List;
+
+/**
+ * Utility to collect projects for a given set of pom.xml files.
+ */
+@Named
+@Singleton
+public class DefaultProjectsCollector implements ProjectsCollector
+{
+    private final Logger logger = LoggerFactory.getLogger( getClass() );
+    private final ProjectBuilder projectBuilder;
+
+    @Inject
+    public DefaultProjectsCollector( ProjectBuilder projectBuilder )
+    {
+        this.projectBuilder = projectBuilder;
+    }
+
+    @Override
+    public void collectProjects( List<MavenProject> projects, List<File> files,
MavenExecutionRequest request )
+            throws ProjectBuildingException
+    {
+        // TODO [mthmulders] Refactor so the result of the method is returned instead of
passed to the method argument.

Review comment:
       TODO?

##########
File path: maven-core/src/main/java/org/apache/maven/graph/ProjectsCollector.java
##########
@@ -0,0 +1,43 @@
+package org.apache.maven.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Facade to collect projects for a given set of pom.xml files.
+ */
+public interface ProjectsCollector
+{
+    /**
+     * Collect Maven projects from a list of POM files.
+     * @param projects List that will be filled with the found projects.
+     * @param files List of POM files.
+     * @param request The {@link MavenExecutionRequest}
+     * @throws ProjectBuildingException In case the POMs are not used.
+     */
+    void collectProjects( List<MavenProject> projects, List<File> files, MavenExecutionRequest
request )
+            throws ProjectBuildingException;

Review comment:
       Shouldn't this be a an exception in the same package (or should ProjectsCollector be
moved to `org.apache.maven.project`?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message