gnodet commented on a change in pull request #607: URL: https://github.com/apache/maven/pull/607#discussion_r750900076
########## File path: maven-caching/src/main/java/org/apache/maven/caching/ProjectUtils.java ########## @@ -0,0 +1,200 @@ +package org.apache.maven.caching; + +/* + * 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.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.caching.xml.build.Scm; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.internal.ProjectIndex; +import org.apache.maven.lifecycle.internal.builder.BuilderCommon; +import org.apache.maven.model.Dependency; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.project.MavenProject; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; + +import static org.apache.commons.lang3.StringUtils.removeStart; +import static org.apache.commons.lang3.StringUtils.trim; +import static org.apache.maven.artifact.Artifact.LATEST_VERSION; +import static org.apache.maven.artifact.Artifact.SNAPSHOT_VERSION; + +/** + * ProjectUtils + */ +public class ProjectUtils +{ + + private static final List<String> PHASES = Arrays.asList( Review comment: One question related to lifecycles: I've just tried to build maven using `mvn install clean -DskipTests` because I was looking for a possible ordering between them. It seems there's none and the above command actually fails. This class relies on an implicit ordering between phases. The `DefaultLifecycles` does provide an explicit ordering in the `getLifeCycles()` method, but it does not really seem to be used. The `DefaultLifecyclePluginAnalyzer.getOrderedLifecycles()` seems to order them by their id (aka name). In this case, the two ordering are the same because `DefaultLifecycles.STANDARD_LIFECYCLES` actually lists lifecycles in a alphabetic order. Though this is a bit inconsistent. The questions are: * should `mvn install clean` execution be somehow reordered as `mvn clean install` ? * should the `DefaultLifecyclePluginAnalyzer` rely on the ordering provided by `DefaultLifecycles` instead of its own ? -- 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]
