View Javadoc
1   package org.apache.maven.execution;
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.io.File;
23  import java.util.Date;
24  import java.util.List;
25  import java.util.Properties;
26  
27  import org.apache.maven.artifact.repository.ArtifactRepository;
28  import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
29  import org.apache.maven.model.Profile;
30  import org.apache.maven.project.ProjectBuildingRequest;
31  import org.apache.maven.settings.Mirror;
32  import org.apache.maven.settings.Proxy;
33  import org.apache.maven.settings.Server;
34  import org.codehaus.plexus.logging.Logger;
35  import org.eclipse.aether.RepositoryCache;
36  import org.eclipse.aether.repository.WorkspaceReader;
37  import org.eclipse.aether.transfer.TransferListener;
38  
39  /**
40   * @author Jason van Zyl
41   */
42  public interface MavenExecutionRequest
43  {
44      // ----------------------------------------------------------------------
45      // Logging
46      // ----------------------------------------------------------------------
47  
48      int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
49  
50      int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
51  
52      int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
53  
54      int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
55  
56      int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
57  
58      int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
59  
60      // ----------------------------------------------------------------------
61      // Reactor Failure Mode
62      // ----------------------------------------------------------------------
63  
64      String REACTOR_FAIL_FAST = "FAIL_FAST";
65  
66      String REACTOR_FAIL_AT_END = "FAIL_AT_END";
67  
68      String REACTOR_FAIL_NEVER = "FAIL_NEVER";
69  
70      // ----------------------------------------------------------------------
71      // Reactor Make Mode
72      // ----------------------------------------------------------------------
73  
74      String REACTOR_MAKE_UPSTREAM = "make-upstream";
75  
76      String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
77  
78      String REACTOR_MAKE_BOTH = "make-both";
79  
80      // ----------------------------------------------------------------------
81      // Artifact repository policies
82      // ----------------------------------------------------------------------
83  
84      String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
85  
86      String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
87  
88      // ----------------------------------------------------------------------
89      //
90      // ----------------------------------------------------------------------
91  
92      // Base directory
93      MavenExecutionRequest setBaseDirectory( File basedir );
94  
95      String getBaseDirectory();
96  
97      // Timing (remove this)
98      MavenExecutionRequest setStartTime( Date start );
99  
100     Date getStartTime();
101 
102     // Goals
103     MavenExecutionRequest setGoals( List<String> goals );
104 
105     List<String> getGoals();
106 
107     // Properties
108 
109     /**
110      * Sets the system properties to use for interpolation and profile activation. The system properties are collected
111      * from the runtime environment like {@link System#getProperties()} and environment variables.
112      * 
113      * @param systemProperties The system properties, may be {@code null}.
114      * @return This request, never {@code null}.
115      */
116     MavenExecutionRequest setSystemProperties( Properties systemProperties );
117 
118     /**
119      * Gets the system properties to use for interpolation and profile activation. The system properties are collected
120      * from the runtime environment like {@link System#getProperties()} and environment variables.
121      * 
122      * @return The system properties, never {@code null}.
123      */
124     Properties getSystemProperties();
125 
126     /**
127      * Sets the user properties to use for interpolation and profile activation. The user properties have been
128      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
129      * line.
130      * 
131      * @param userProperties The user properties, may be {@code null}.
132      * @return This request, never {@code null}.
133      */
134     MavenExecutionRequest setUserProperties( Properties userProperties );
135 
136     /**
137      * Gets the user properties to use for interpolation and profile activation. The user properties have been
138      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
139      * line.
140      * 
141      * @return The user properties, never {@code null}.
142      */
143     Properties getUserProperties();
144 
145     // Reactor
146     MavenExecutionRequest setReactorFailureBehavior( String failureBehavior );
147 
148     String getReactorFailureBehavior();
149 
150     MavenExecutionRequest setSelectedProjects( List<String> projects );
151 
152     List<String> getSelectedProjects();
153 
154     /**
155      * @param projects the projects to exclude
156      * @return this MavenExecutionRequest
157      * @since 3.2
158      */
159     MavenExecutionRequest setExcludedProjects( List<String> projects );
160 
161     /**
162      * @return the excluded projects, never {@code null}
163      * @since 3.2
164      */
165     List<String> getExcludedProjects();
166 
167     MavenExecutionRequest setResumeFrom( String project );
168 
169     String getResumeFrom();
170 
171     MavenExecutionRequest setMakeBehavior( String makeBehavior );
172 
173     String getMakeBehavior();
174 
175     /**
176      * Set's the parallel degree of concurrency used by the build.
177      * 
178      * @param degreeOfConcurrency
179      */
180     public void setDegreeOfConcurrency( final int degreeOfConcurrency );
181 
182     /**
183      * @return the degree of concurrency for the build.
184      */
185     public int getDegreeOfConcurrency();
186 
187     // Recursive (really to just process the top-level POM)
188     MavenExecutionRequest setRecursive( boolean recursive );
189 
190     boolean isRecursive();
191 
192     MavenExecutionRequest setPom( File pom );
193 
194     File getPom();
195 
196     // Errors
197     MavenExecutionRequest setShowErrors( boolean showErrors );
198 
199     boolean isShowErrors();
200 
201     // Transfer listeners
202     MavenExecutionRequest setTransferListener( TransferListener transferListener );
203 
204     TransferListener getTransferListener();
205 
206     // Logging
207     MavenExecutionRequest setLoggingLevel( int loggingLevel );
208 
209     int getLoggingLevel();
210 
211     // Update snapshots
212     MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots );
213 
214     boolean isUpdateSnapshots();
215 
216     MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates );
217 
218     boolean isNoSnapshotUpdates();
219 
220     // Checksum policy
221     MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy );
222 
223     String getGlobalChecksumPolicy();
224 
225     // Local repository
226     MavenExecutionRequest setLocalRepositoryPath( String localRepository );
227 
228     MavenExecutionRequest setLocalRepositoryPath( File localRepository );
229 
230     File getLocalRepositoryPath();
231 
232     MavenExecutionRequest setLocalRepository( ArtifactRepository repository );
233 
234     ArtifactRepository getLocalRepository();
235 
236     // Interactive
237     MavenExecutionRequest setInteractiveMode( boolean interactive );
238 
239     boolean isInteractiveMode();
240 
241     // Offline
242     MavenExecutionRequest setOffline( boolean offline );
243 
244     boolean isOffline();
245 
246     boolean isCacheTransferError();
247 
248     MavenExecutionRequest setCacheTransferError( boolean cacheTransferError );
249 
250     boolean isCacheNotFound();
251 
252     MavenExecutionRequest setCacheNotFound( boolean cacheNotFound );
253 
254     // Profiles
255     List<Profile> getProfiles();
256 
257     MavenExecutionRequest addProfile( Profile profile );
258 
259     MavenExecutionRequest setProfiles( List<Profile> profiles );
260 
261     MavenExecutionRequest addActiveProfile( String profile );
262 
263     MavenExecutionRequest addActiveProfiles( List<String> profiles );
264 
265     MavenExecutionRequest setActiveProfiles( List<String> profiles );
266 
267     List<String> getActiveProfiles();
268 
269     MavenExecutionRequest addInactiveProfile( String profile );
270 
271     MavenExecutionRequest addInactiveProfiles( List<String> profiles );
272 
273     MavenExecutionRequest setInactiveProfiles( List<String> profiles );
274 
275     List<String> getInactiveProfiles();
276 
277     // Proxies
278     List<Proxy> getProxies();
279 
280     MavenExecutionRequest setProxies( List<Proxy> proxies );
281 
282     MavenExecutionRequest addProxy( Proxy proxy );
283 
284     // Servers
285     List<Server> getServers();
286 
287     MavenExecutionRequest setServers( List<Server> servers );
288 
289     MavenExecutionRequest addServer( Server server );
290 
291     // Mirrors
292     List<Mirror> getMirrors();
293 
294     MavenExecutionRequest setMirrors( List<Mirror> mirrors );
295 
296     MavenExecutionRequest addMirror( Mirror mirror );
297 
298     // Plugin groups
299     List<String> getPluginGroups();
300 
301     MavenExecutionRequest setPluginGroups( List<String> pluginGroups );
302 
303     MavenExecutionRequest addPluginGroup( String pluginGroup );
304 
305     MavenExecutionRequest addPluginGroups( List<String> pluginGroups );
306 
307     boolean isProjectPresent();
308 
309     MavenExecutionRequest setProjectPresent( boolean isProjectPresent );
310 
311     File getUserSettingsFile();
312 
313     MavenExecutionRequest setUserSettingsFile( File userSettingsFile );
314 
315     File getGlobalSettingsFile();
316 
317     MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile );
318 
319     MavenExecutionRequest addRemoteRepository( ArtifactRepository repository );
320 
321     MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository );
322 
323     /**
324      * Set a new list of remote repositories to use the execution request. This is necessary if you perform
325      * transformations on the remote repositories being used. For example if you replace existing repositories with
326      * mirrors then it's easier to just replace the whole list with a new list of transformed repositories.
327      * 
328      * @param repositories
329      * @return This request, never {@code null}.
330      */
331     MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> repositories );
332 
333     List<ArtifactRepository> getRemoteRepositories();
334 
335     MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> repositories );
336 
337     List<ArtifactRepository> getPluginArtifactRepositories();
338 
339     MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache );
340 
341     RepositoryCache getRepositoryCache();
342 
343     WorkspaceReader getWorkspaceReader();
344 
345     MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader );
346 
347     File getUserToolchainsFile();
348 
349     MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
350 
351     ExecutionListener getExecutionListener();
352 
353     MavenExecutionRequest setExecutionListener( ExecutionListener executionListener );
354 
355     ProjectBuildingRequest getProjectBuildingRequest();
356 
357     /**
358      * @since 3.1
359      */
360     boolean isUseLegacyLocalRepository();
361 
362     /**
363      * @since 3.1
364      */
365     MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepository );
366 
367     /**
368      * Controls the {@link Builder} used by Maven by specification of the builder's id.
369      * 
370      * @since 3.2.0
371      */
372     MavenExecutionRequest setBuilderId( String builderId );
373 
374     /**
375      * Controls the {@link Builder} used by Maven by specification of the builders id.
376      * 
377      * @since 3.2.0
378      */
379     String getBuilderId();
380 
381 }