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.sonatype.aether.RepositoryCache;
36  import org.sonatype.aether.repository.WorkspaceReader;
37  import org.sonatype.aether.transfer.TransferListener;
38  
39  /**
40   * @author Jason van Zyl
41   * @version $Id: MavenExecutionRequest.java 995600 2010-09-09 22:52:57Z bentmann $
42   */
43  public interface MavenExecutionRequest
44  {
45      // ----------------------------------------------------------------------
46      // Logging
47      // ----------------------------------------------------------------------
48  
49      final int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
50  
51      final int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
52  
53      final int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
54  
55      final int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
56  
57      final int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
58  
59      final int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
60  
61      // ----------------------------------------------------------------------
62      // Reactor Failure Mode
63      // ----------------------------------------------------------------------
64  
65      final String REACTOR_FAIL_FAST = "FAIL_FAST";
66  
67      final String REACTOR_FAIL_AT_END = "FAIL_AT_END";
68  
69      final String REACTOR_FAIL_NEVER = "FAIL_NEVER";
70  
71      // ----------------------------------------------------------------------
72      // Reactor Make Mode
73      // ----------------------------------------------------------------------
74  
75      final String REACTOR_MAKE_UPSTREAM = "make-upstream";
76  
77      final String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
78  
79      final String REACTOR_MAKE_BOTH = "make-both";
80  
81      // ----------------------------------------------------------------------
82      // Artifact repository policies
83      // ----------------------------------------------------------------------
84  
85      final String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
86  
87      final String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
88  
89      // ----------------------------------------------------------------------
90      //
91      // ----------------------------------------------------------------------
92  
93      // Base directory
94      MavenExecutionRequest setBaseDirectory( File basedir );
95      String getBaseDirectory();
96  
97      // Timing (remove this)
98      MavenExecutionRequest setStartTime( Date start );
99      Date getStartTime();
100 
101     // Goals
102     MavenExecutionRequest setGoals( List<String> goals );
103     List<String> getGoals();
104 
105     // Properties
106 
107     /**
108      * Sets the system properties to use for interpolation and profile activation. The system properties are collected
109      * from the runtime environment like {@link System#getProperties()} and environment variables.
110      *
111      * @param systemProperties The system properties, may be {@code null}.
112      * @return This request, never {@code null}.
113      */
114     MavenExecutionRequest setSystemProperties( Properties systemProperties );
115 
116     /**
117      * Gets 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      * @return The system properties, never {@code null}.
121      */
122     Properties getSystemProperties();
123 
124     /**
125      * Sets the user properties to use for interpolation and profile activation. The user properties have been
126      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
127      * line.
128      *
129      * @param userProperties The user properties, may be {@code null}.
130      * @return This request, never {@code null}.
131      */
132     MavenExecutionRequest setUserProperties( Properties userProperties );
133 
134     /**
135      * Gets the user properties to use for interpolation and profile activation. The user properties have been
136      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
137      * line.
138      *
139      * @return The user properties, never {@code null}.
140      */
141     Properties getUserProperties();
142 
143     // Reactor
144     MavenExecutionRequest setReactorFailureBehavior( String failureBehavior );
145     String getReactorFailureBehavior();
146 
147     MavenExecutionRequest setSelectedProjects( List<String> projects );
148     List<String> getSelectedProjects();
149 
150     MavenExecutionRequest setResumeFrom( String project );
151     String getResumeFrom();
152 
153     MavenExecutionRequest setMakeBehavior( String makeBehavior );
154     String getMakeBehavior();
155 
156     void setThreadCount( String threadCount );
157     String getThreadCount();
158     boolean isThreadConfigurationPresent();
159     void setPerCoreThreadCount( boolean perCoreThreadCount );
160     boolean isPerCoreThreadCount();
161 
162     // Recursive (really to just process the top-level POM)
163     MavenExecutionRequest setRecursive( boolean recursive );
164     boolean isRecursive();
165 
166     MavenExecutionRequest setPom( File pom );
167     File getPom();
168 
169     // Errors
170     MavenExecutionRequest setShowErrors( boolean showErrors );
171     boolean isShowErrors();
172 
173     // Transfer listeners
174     MavenExecutionRequest setTransferListener( TransferListener transferListener );
175     TransferListener getTransferListener();
176 
177     // Logging
178     MavenExecutionRequest setLoggingLevel( int loggingLevel );
179     int getLoggingLevel();
180 
181     // Update snapshots
182     MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots );
183     boolean isUpdateSnapshots();
184 
185     MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates );
186     boolean isNoSnapshotUpdates();
187 
188     // Checksum policy
189     MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy );
190     String getGlobalChecksumPolicy();
191 
192     // Local repository
193     MavenExecutionRequest setLocalRepositoryPath( String localRepository );
194     MavenExecutionRequest setLocalRepositoryPath( File localRepository );
195     File getLocalRepositoryPath();
196     MavenExecutionRequest setLocalRepository( ArtifactRepository repository );
197     ArtifactRepository getLocalRepository();
198 
199     // Interactive
200     MavenExecutionRequest setInteractiveMode( boolean interactive );
201     boolean isInteractiveMode();
202 
203     // Offline
204     MavenExecutionRequest setOffline( boolean offline );
205     boolean isOffline();
206 
207     boolean isCacheTransferError();
208     MavenExecutionRequest setCacheTransferError( boolean cacheTransferError );
209 
210     boolean isCacheNotFound();
211     MavenExecutionRequest setCacheNotFound( boolean cacheNotFound );
212 
213     // Profiles
214     List<Profile> getProfiles();
215     MavenExecutionRequest addProfile( Profile profile );
216     MavenExecutionRequest setProfiles( List<Profile> profiles );
217     MavenExecutionRequest addActiveProfile( String profile );
218     MavenExecutionRequest addActiveProfiles( List<String> profiles );
219     MavenExecutionRequest setActiveProfiles( List<String> profiles );
220     List<String> getActiveProfiles();
221     MavenExecutionRequest addInactiveProfile( String profile );
222     MavenExecutionRequest addInactiveProfiles( List<String> profiles );
223     MavenExecutionRequest setInactiveProfiles( List<String> profiles );
224     List<String> getInactiveProfiles();
225 
226     // Proxies
227     List<Proxy> getProxies();
228     MavenExecutionRequest setProxies( List<Proxy> proxies );
229     MavenExecutionRequest addProxy( Proxy proxy );
230 
231     // Servers
232     List<Server> getServers();
233     MavenExecutionRequest setServers( List<Server> servers );
234     MavenExecutionRequest addServer( Server server );
235 
236     // Mirrors
237     List<Mirror> getMirrors();
238     MavenExecutionRequest setMirrors( List<Mirror> mirrors );
239     MavenExecutionRequest addMirror( Mirror mirror );
240 
241     // Plugin groups
242     List<String> getPluginGroups();
243     MavenExecutionRequest setPluginGroups( List<String> pluginGroups );
244     MavenExecutionRequest addPluginGroup( String pluginGroup );
245     MavenExecutionRequest addPluginGroups( List<String> pluginGroups );
246 
247     boolean isProjectPresent();
248     MavenExecutionRequest setProjectPresent( boolean isProjectPresent );
249 
250     File getUserSettingsFile();
251     MavenExecutionRequest setUserSettingsFile( File userSettingsFile );
252 
253     File getGlobalSettingsFile();
254     MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile );
255 
256     MavenExecutionRequest addRemoteRepository( ArtifactRepository repository );
257     MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository );
258 
259     /**
260      * Set a new list of remote repositories to use the execution request. This is necessary if you perform
261      * transformations on the remote repositories being used. For example if you replace existing repositories with
262      * mirrors then it's easier to just replace the whole list with a new list of transformed repositories.
263      *
264      * @param repositories
265      * @return
266      */
267     MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> repositories );
268     List<ArtifactRepository> getRemoteRepositories();
269 
270     MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> repositories );
271     List<ArtifactRepository> getPluginArtifactRepositories();
272 
273     MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache );
274     RepositoryCache getRepositoryCache();
275 
276     WorkspaceReader getWorkspaceReader();
277     MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader );
278 
279     File getUserToolchainsFile();
280     MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
281 
282     ExecutionListener getExecutionListener();
283     MavenExecutionRequest setExecutionListener( ExecutionListener executionListener );
284 
285     ProjectBuildingRequest getProjectBuildingRequest();
286 
287 }