01: package org.apache.maven.project.build.model;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: import org.apache.maven.artifact.repository.ArtifactRepository;
23: import org.apache.maven.profiles.ProfileManager;
24: import org.apache.maven.project.ProjectBuildingException;
25:
26: import java.io.File;
27: import java.util.List;
28:
29: /**
30: * Builds the lineage of Model instances, starting from a given POM file, and stretching back through
31: * all of the parent POMs that are defined in the respective <parent/> sections.
32: *
33: * NOTE: In all of the build/resume methods below, each Model MUST have its active profiles searched
34: * for new repositories from which to discover parent POMs.
35: */
36: public interface ModelLineageBuilder {
37:
38: String ROLE = ModelLineageBuilder.class.getName();
39:
40: /**
41: * Construct a lineage of the current POM plus all of its ancestors.
42: *
43: * COMING: Also, set ProjectBuildContext.currentModelLineage build-context to the result of this
44: * method before returning.
45: *
46: * @param pom The current POM, whose Model will terminate the constructed lineage
47: * @param localRepository The local repository against which parent POMs should be resolved
48: * @param remoteRepositories List of ArtifactRepository instances against which parent POMs
49: * should be resolved
50: * @param profileManager The profile manager containing information about global profiles to be
51: * applied (from settings.xml, for instance)
52: * @param allowStubs Whether stubbed-out Model instances should be constructed in the event that
53: * a parent-POM cannot be resolved.
54: */
55: ModelLineage buildModelLineage(File pom,
56: ArtifactRepository localRepository,
57: List remoteRepositories, ProfileManager profileManager,
58: boolean allowStubs) throws ProjectBuildingException;
59:
60: /**
61: * Resume the process of constructing a lineage of inherited models, picking up using the deepest
62: * parent already in the lineage.
63: *
64: * @param lineage The ModelLineage instance in progress, which should be completed.
65: * @param localRepository The local repository against which parent POMs should be resolved
66: * @param profileManager The profile manager containing information about global profiles to be
67: * applied (from settings.xml, for instance)
68: * @param allowStubs Whether stubbed-out Model instances should be constructed in the event that
69: * a parent-POM cannot be resolved.
70: */
71: void resumeBuildingModelLineage(ModelLineage lineage,
72: ArtifactRepository localRepository,
73: ProfileManager profileManager, boolean allowStubs)
74: throws ProjectBuildingException;
75:
76: }
|