001package org.apache.maven.execution;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.io.File;
023import java.util.Date;
024import java.util.List;
025import java.util.Map;
026import java.util.Properties;
027
028import org.apache.maven.artifact.repository.ArtifactRepository;
029import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
030import org.apache.maven.eventspy.internal.EventSpyDispatcher;
031import org.apache.maven.model.Profile;
032import org.apache.maven.project.ProjectBuildingRequest;
033//
034// These settings values need to be removed and pushed down into a provider of configuration information
035//
036import org.apache.maven.settings.Mirror;
037import org.apache.maven.settings.Proxy;
038import org.apache.maven.settings.Server;
039//
040import org.apache.maven.toolchain.model.ToolchainModel;
041import org.codehaus.plexus.logging.Logger;
042import org.eclipse.aether.RepositoryCache;
043import org.eclipse.aether.repository.WorkspaceReader;
044import org.eclipse.aether.transfer.TransferListener;
045
046/**
047 * @author Jason van Zyl
048 */
049public interface MavenExecutionRequest
050{
051    // ----------------------------------------------------------------------
052    // Logging
053    // ----------------------------------------------------------------------
054
055    int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
056
057    int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
058
059    int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
060
061    int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
062
063    int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
064
065    int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
066
067    // ----------------------------------------------------------------------
068    // Reactor Failure Mode
069    // ----------------------------------------------------------------------
070
071    String REACTOR_FAIL_FAST = "FAIL_FAST";
072
073    String REACTOR_FAIL_AT_END = "FAIL_AT_END";
074
075    String REACTOR_FAIL_NEVER = "FAIL_NEVER";
076
077    // ----------------------------------------------------------------------
078    // Reactor Make Mode
079    // ----------------------------------------------------------------------
080
081    String REACTOR_MAKE_UPSTREAM = "make-upstream";
082
083    String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
084
085    String REACTOR_MAKE_BOTH = "make-both";
086
087    // ----------------------------------------------------------------------
088    // Artifact repository policies
089    // ----------------------------------------------------------------------
090
091    String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
092
093    String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
094
095    // ----------------------------------------------------------------------
096    //
097    // ----------------------------------------------------------------------
098
099    // 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}