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