View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.project;
20  
21  import java.io.File;
22  import java.util.List;
23  
24  import org.apache.maven.artifact.Artifact;
25  import org.apache.maven.model.building.ModelSource;
26  
27  /**
28   * Builds in-memory descriptions of projects.
29   *
30   * @deprecated use {@code org.apache.maven.api.services.ProjectBuilder} instead
31   */
32  @Deprecated(since = "4.0.0")
33  public interface ProjectBuilder {
34  
35      /**
36       * Builds a project descriptor from the specified POM file.
37       *
38       * @param projectFile The POM file to build the project from, must not be {@code null}.
39       * @param request The project building request that holds further parameters, must not be {@code null}.
40       * @return The result of the project building, never {@code null}.
41       * @throws ProjectBuildingException If the project descriptor could not be successfully built.
42       */
43      ProjectBuildingResult build(File projectFile, ProjectBuildingRequest request) throws ProjectBuildingException;
44  
45      /**
46       * Builds a project descriptor for the specified artifact.
47       *
48       * @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
49       * @param request The project building request that holds further parameters, must not be {@code null}.
50       * @return The result of the project building, never {@code null}.
51       * @throws ProjectBuildingException If the project descriptor could not be successfully built.
52       */
53      ProjectBuildingResult build(Artifact projectArtifact, ProjectBuildingRequest request)
54              throws ProjectBuildingException;
55  
56      /**
57       * Builds a project descriptor for the specified artifact.
58       *
59       * @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
60       * @param allowStubModel A flag controlling the case of a missing POM artifact. If {@code true} and the specified
61       *            POM artifact does not exist, a simple stub model will be returned. If {@code false}, an exception will
62       *            be thrown.
63       * @param request The project building request that holds further parameters, must not be {@code null}.
64       * @return The result of the project building, never {@code null}.
65       * @throws ProjectBuildingException If the project descriptor could not be successfully built.
66       */
67      ProjectBuildingResult build(Artifact projectArtifact, boolean allowStubModel, ProjectBuildingRequest request)
68              throws ProjectBuildingException;
69  
70      /**
71       * Builds a project descriptor for the specified model source.
72       *
73       * @param modelSource The source of the model to build the project descriptor from, must not be {@code null}.
74       * @param request The project building request that holds further parameters, must not be {@code null}.
75       * @return The result of the project building, never {@code null}.
76       * @throws ProjectBuildingException If the project descriptor could not be successfully built.
77       *
78       * @see org.apache.maven.model.building.ModelSource2
79       */
80      ProjectBuildingResult build(ModelSource modelSource, ProjectBuildingRequest request)
81              throws ProjectBuildingException;
82  
83      /**
84       * Builds a project descriptor for the specified model source.
85       *
86       * @param modelSource The source of the model to build the project descriptor from, must not be {@code null}.
87       * @param request The project building request that holds further parameters, must not be {@code null}.
88       * @return The result of the project building, never {@code null}.
89       * @throws ProjectBuildingException If the project descriptor could not be successfully built.
90       *
91       * @see org.apache.maven.model.building.ModelSource2
92       */
93      ProjectBuildingResult build(org.apache.maven.api.services.ModelSource modelSource, ProjectBuildingRequest request)
94              throws ProjectBuildingException;
95  
96      /**
97       * Builds the projects for the specified POM files and optionally their children.
98       *
99       * @param pomFiles The POM files to build, must not be {@code null}.
100      * @param recursive {@code true} to recursively build submodules referenced by the POM files, {@code false} to
101      *            build only the specified POM files.
102      * @param request The project builder configuration that provides further parameters, must not be {@code null}.
103      * @return The results of the project builder where each result corresponds to one project that was built, never
104      *         {@code null}.
105      * @throws ProjectBuildingException If an error was encountered during building of any project.
106      *             {@link ProjectBuildingException#getResults()} provides access to the details of the problems.
107      */
108     List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive, ProjectBuildingRequest request)
109             throws ProjectBuildingException;
110 }