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