View Javadoc

1   package org.apache.maven.project;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "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.Artifact;
23  import org.apache.maven.artifact.repository.ArtifactRepository;
24  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
25  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
26  import org.apache.maven.profiles.ProfileManager;
27  import org.apache.maven.wagon.events.TransferListener;
28  
29  import java.io.File;
30  import java.util.List;
31  
32  public interface MavenProjectBuilder
33  {
34      String ROLE = MavenProjectBuilder.class.getName();
35  
36      String STANDALONE_SUPERPOM_GROUPID = "org.apache.maven";
37  
38      String STANDALONE_SUPERPOM_ARTIFACTID = "super-pom";
39  
40      String STANDALONE_SUPERPOM_VERSION = "2.0";
41  
42      MavenProject build( File project, ArtifactRepository localRepository, ProfileManager globalProfileManager )
43          throws ProjectBuildingException;
44  
45      MavenProject build( File project, ArtifactRepository localRepository, ProfileManager globalProfileManager,
46                          boolean checkDistributionManagementStatus )
47          throws ProjectBuildingException;
48  
49      // ----------------------------------------------------------------------
50      // These methods are used by the MavenEmbedder
51      // ----------------------------------------------------------------------
52  
53      MavenProject buildWithDependencies( File project, ArtifactRepository localRepository,
54                                          ProfileManager globalProfileManager, TransferListener transferListener )
55          throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException;
56  
57      MavenProject buildWithDependencies( File project, ArtifactRepository localRepository,
58                                          ProfileManager globalProfileManager )
59          throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException;
60  
61      // ----------------------------------------------------------------------
62      //
63      // ----------------------------------------------------------------------
64  
65      /**
66       * Build the artifact from the local repository, resolving it if necessary.
67       *
68       * @param artifact the artifact description
69       * @param localRepository the local repository
70       * @param remoteArtifactRepositories the remote repository list
71       * @return the built project
72       * @throws ProjectBuildingException
73       */
74      MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
75                                        ArtifactRepository localRepository )
76          throws ProjectBuildingException;
77  
78      /**
79       * Build the artifact from the local repository, resolving it if necessary.
80       *
81       * @param artifact the artifact description
82       * @param localRepository the local repository
83       * @param remoteArtifactRepositories the remote repository list
84       * @param allowStubModel return a stub if the POM is not found
85       * @return the built project
86       * @throws ProjectBuildingException
87       */
88      MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
89                                        ArtifactRepository localRepository, boolean allowStubModel )
90          throws ProjectBuildingException;
91  
92      /**
93       * @deprecated Use {@link MavenProjectBuilder#buildStandaloneSuperProject(ProjectBuilderConfiguration)} instead.
94       */
95      MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository )
96          throws ProjectBuildingException;
97  
98      /**
99       * need to pass a profilemanager with correct context (eg. with execution properties)
100      * @deprecated Use {@link MavenProjectBuilder#buildStandaloneSuperProject(ProjectBuilderConfiguration)} instead.
101      */
102     MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager )
103         throws ProjectBuildingException;
104 
105     MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration config )
106         throws ProjectBuildingException;
107 
108     MavenProject build( File pom,
109                         ProjectBuilderConfiguration config )
110         throws ProjectBuildingException;
111 
112     MavenProject build( File pom,
113                         ProjectBuilderConfiguration config,
114                         boolean checkDistributionManagementStatus )
115         throws ProjectBuildingException;
116 }