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 java.util.Date;
23  import java.util.List;
24  import java.util.Properties;
25  
26  import org.apache.maven.artifact.repository.ArtifactRepository;
27  import org.apache.maven.model.Profile;
28  import org.apache.maven.model.building.ModelBuildingRequest;
29  import org.eclipse.aether.RepositorySystemSession;
30  
31  public interface ProjectBuildingRequest
32  {
33  
34      ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
35      
36      ArtifactRepository getLocalRepository();
37  
38      ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
39  
40      List<ArtifactRepository> getRemoteRepositories();
41  
42      ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories );
43  
44      List<ArtifactRepository> getPluginArtifactRepositories();
45  
46      /**
47       * Sets the system properties to use for interpolation and profile activation. The system properties are collected
48       * from the runtime environment like {@link System#getProperties()} and environment variables.
49       * 
50       * @param systemProperties The system properties, may be {@code null}.
51       * @return This request, never {@code null}.
52       */
53      ProjectBuildingRequest setSystemProperties( Properties systemProperties );
54  
55      /**
56       * Gets the system properties to use for interpolation and profile activation. The system properties are collected
57       * from the runtime environment like {@link System#getProperties()} and environment variables.
58       * 
59       * @return The system properties, never {@code null}.
60       */
61      Properties getSystemProperties();
62  
63      /**
64       * Sets the user properties to use for interpolation and profile activation. The user properties have been
65       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
66       * line.
67       * 
68       * @param userProperties The user properties, may be {@code null}.
69       * @return This request, never {@code null}.
70       */
71      ProjectBuildingRequest setUserProperties( Properties userProperties );
72  
73      /**
74       * Gets the user properties to use for interpolation and profile activation. The user properties have been
75       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
76       * line.
77       * 
78       * @return The user properties, never {@code null}.
79       */
80      Properties getUserProperties();
81  
82      void setProject( MavenProject mavenProject );
83  
84      MavenProject getProject();
85  
86      ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
87  
88      boolean isProcessPlugins();
89  
90      ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies );
91  
92      boolean isResolveDependencies();
93  
94      /**
95       * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
96       * 
97       * @param validationLevel The level of validation to perform on processed models, e.g.
98       *            {@link ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
99       * @return This configuration, never {@code null}.
100      */
101     ProjectBuildingRequest setValidationLevel( int validationLevel );
102 
103     /**
104      * Gets the level of validation to perform on processed models.
105      * 
106      * @return The level of validation to perform on processed models.
107      */
108     int getValidationLevel();
109 
110     // Profiles
111     
112     /**
113      * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
114      * a {@link MavenProject}.
115      */
116     void setActiveProfileIds( List<String> activeProfileIds );
117         
118     List<String> getActiveProfileIds();
119 
120     void setInactiveProfileIds( List<String> inactiveProfileIds );
121 
122     List<String> getInactiveProfileIds();
123     
124     /**
125      * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
126      * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
127      * 
128      * @param profile
129      */
130     void addProfile( Profile profile );
131     
132     void setProfiles( List<Profile> profiles );
133     
134     List<Profile> getProfiles();
135 
136     /**
137      * Gets the start time of the build.
138      * 
139      * @return The start time of the build or {@code null} if unknown.
140      */
141     Date getBuildStartTime();
142 
143     /**
144      * Sets the start time of the build.
145      * 
146      * @param buildStartTime The start time of the build, may be {@code null}.
147      */
148     void setBuildStartTime( Date buildStartTime );
149 
150     RepositorySystemSession getRepositorySession();
151 
152     ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession );
153 
154     /**
155      * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this
156      * request.
157      * 
158      * @param mode The repository merge mode, must not be {@code null}.
159      * @return This request for chaining, never {@code null}.
160      * @see #setRemoteRepositories(List)
161      */
162     ProjectBuildingRequest setRepositoryMerging( RepositoryMerging mode );
163 
164     /**
165      * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this
166      * request
167      * 
168      * @return The merge mode, never {@code null}.
169      */
170     RepositoryMerging getRepositoryMerging();
171 
172     /**
173      * The possible merge modes for combining remote repositories.
174      */
175     enum RepositoryMerging
176     {
177 
178         /**
179          * The repositories declared in the POM have precedence over the repositories specified in the request.
180          */
181         POM_DOMINANT,
182 
183         /**
184          * The repositories specified in the request have precedence over the repositories declared in the POM.
185          */
186         REQUEST_DOMINANT,
187     }
188 
189 }