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.ArrayList;
24  import java.util.Date;
25  import java.util.List;
26  import java.util.Properties;
27  
28  import org.apache.maven.artifact.repository.ArtifactRepository;
29  import org.apache.maven.model.Profile;
30  import org.apache.maven.project.DefaultProjectBuildingRequest;
31  import org.apache.maven.project.ProjectBuildingRequest;
32  import org.apache.maven.settings.Mirror;
33  import org.apache.maven.settings.Proxy;
34  import org.apache.maven.settings.Server;
35  import org.eclipse.aether.DefaultRepositoryCache;
36  import org.eclipse.aether.RepositoryCache;
37  import org.eclipse.aether.repository.WorkspaceReader;
38  import org.eclipse.aether.transfer.TransferListener;
39  
40  /**
41   * @author Jason van Zyl
42   */
43  public class DefaultMavenExecutionRequest
44      implements MavenExecutionRequest
45  {
46  
47      private RepositoryCache repositoryCache = new DefaultRepositoryCache();
48  
49      private WorkspaceReader workspaceReader;
50  
51      private ArtifactRepository localRepository;
52  
53      private File localRepositoryPath;
54  
55      private boolean offline = false;
56  
57      private boolean interactiveMode = true;
58  
59      private boolean cacheTransferError;
60  
61      private boolean cacheNotFound;
62  
63      private List<Proxy> proxies;
64  
65      private List<Server> servers;
66  
67      private List<Mirror> mirrors;
68  
69      private List<Profile> profiles;
70  
71      private List<String> pluginGroups;
72  
73      private boolean isProjectPresent = true;
74  
75      // ----------------------------------------------------------------------------
76      // We need to allow per execution user and global settings as the embedder
77      // might be running in a mode where its executing many threads with totally
78      // different settings.
79      // ----------------------------------------------------------------------------
80  
81      private File userSettingsFile;
82  
83      private File globalSettingsFile;
84  
85      private File userToolchainsFile;
86  
87      // ----------------------------------------------------------------------------
88      // Request
89      // ----------------------------------------------------------------------------
90  
91      private File basedir;
92  
93      private List<String> goals;
94  
95      private boolean useReactor = false;
96  
97      private boolean recursive = true;
98  
99      private File pom;
100 
101     private String reactorFailureBehavior = REACTOR_FAIL_FAST;
102 
103     private List<String> selectedProjects;
104 
105     private String resumeFrom;
106 
107     private String makeBehavior;
108 
109     private Properties systemProperties;
110 
111     private Properties userProperties;
112 
113     private Date startTime;
114 
115     private boolean showErrors = false;
116 
117     private List<String> activeProfiles;
118 
119     private List<String> inactiveProfiles;
120 
121     private TransferListener transferListener;
122 
123     private int loggingLevel = LOGGING_LEVEL_INFO;
124 
125     private String globalChecksumPolicy;
126 
127     private boolean updateSnapshots = false;
128 
129     private List<ArtifactRepository> remoteRepositories;
130 
131     private List<ArtifactRepository> pluginArtifactRepositories;
132 
133     private ExecutionListener executionListener;
134 
135     private String threadCount;
136 
137     private boolean perCoreThreadCount;
138 
139     /**
140      * Suppress SNAPSHOT updates.
141      *
142      * @issue MNG-2681
143      */
144     private boolean noSnapshotUpdates;
145 
146     private boolean useSimpleLocalRepositoryManager = false;
147 
148     public DefaultMavenExecutionRequest()
149     {
150     }
151 
152     public static MavenExecutionRequest copy( MavenExecutionRequest original )
153     {
154         DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest();
155         copy.setLocalRepository( original.getLocalRepository() );
156         copy.setLocalRepositoryPath( original.getLocalRepositoryPath() );
157         copy.setOffline( original.isOffline() );
158         copy.setInteractiveMode( original.isInteractiveMode() );
159         copy.setCacheNotFound( original.isCacheNotFound() );
160         copy.setCacheTransferError( original.isCacheTransferError() );
161         copy.setProxies( original.getProxies() );
162         copy.setServers( original.getServers() );
163         copy.setMirrors( original.getMirrors() );
164         copy.setProfiles( original.getProfiles() );
165         copy.setPluginGroups( original.getPluginGroups() );
166         copy.setProjectPresent( original.isProjectPresent() );
167         copy.setUserSettingsFile( original.getUserSettingsFile() );
168         copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
169         copy.setUserToolchainsFile( original.getUserToolchainsFile() );
170         copy.setBaseDirectory( ( original.getBaseDirectory() != null )
171                                ? new File( original.getBaseDirectory() ) : null );
172         copy.setGoals( original.getGoals() );
173         copy.setRecursive( original.isRecursive() );
174         copy.setPom( original.getPom() );
175         copy.setSystemProperties( original.getSystemProperties() );
176         copy.setUserProperties( original.getUserProperties() );
177         copy.setShowErrors( original.isShowErrors() );
178         copy.setActiveProfiles( original.getActiveProfiles() );
179         copy.setInactiveProfiles( original.getInactiveProfiles() );
180         copy.setTransferListener( original.getTransferListener() );
181         copy.setLoggingLevel( original.getLoggingLevel() );
182         copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy() );
183         copy.setUpdateSnapshots( original.isUpdateSnapshots() );
184         copy.setRemoteRepositories( original.getRemoteRepositories() );
185         copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
186         copy.setRepositoryCache( original.getRepositoryCache() );
187         copy.setWorkspaceReader( original.getWorkspaceReader() );
188         copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
189         copy.setExecutionListener( original.getExecutionListener() );
190         return copy;
191     }
192 
193     public String getBaseDirectory()
194     {
195         if ( basedir == null )
196         {
197             return null;
198         }
199 
200         return basedir.getAbsolutePath();
201     }
202 
203     public ArtifactRepository getLocalRepository()
204     {
205         return localRepository;
206     }
207 
208     public File getLocalRepositoryPath()
209     {
210         return localRepositoryPath;
211     }
212 
213     public List<String> getGoals()
214     {
215         if ( goals == null )
216         {
217             goals = new ArrayList<String>();
218         }
219         return goals;
220     }
221 
222     public Properties getSystemProperties()
223     {
224         if ( systemProperties == null )
225         {
226             systemProperties = new Properties();
227         }
228 
229         return systemProperties;
230     }
231 
232     public Properties getUserProperties()
233     {
234         if ( userProperties == null )
235         {
236             userProperties = new Properties();
237         }
238 
239         return userProperties;
240     }
241 
242     public File getPom()
243     {
244         return pom;
245     }
246 
247     public String getReactorFailureBehavior()
248     {
249         return reactorFailureBehavior;
250     }
251 
252     public List<String> getSelectedProjects()
253     {
254         if ( selectedProjects == null )
255         {
256             selectedProjects = new ArrayList<String>();
257         }
258 
259         return selectedProjects;
260     }
261 
262     public String getResumeFrom()
263     {
264         return resumeFrom;
265     }
266 
267     public String getMakeBehavior()
268     {
269         return makeBehavior;
270     }
271 
272     public Date getStartTime()
273     {
274         return startTime;
275     }
276 
277     public boolean isShowErrors()
278     {
279         return showErrors;
280     }
281 
282     public boolean isInteractiveMode()
283     {
284         return interactiveMode;
285     }
286 
287     public MavenExecutionRequest setActiveProfiles( List<String> activeProfiles )
288     {
289         if ( activeProfiles != null )
290         {
291             this.activeProfiles = new ArrayList<String>( activeProfiles );
292         }
293         else
294         {
295             this.activeProfiles = null;
296         }
297 
298         return this;
299     }
300 
301     public MavenExecutionRequest setInactiveProfiles( List<String> inactiveProfiles )
302     {
303         if ( inactiveProfiles != null )
304         {
305             this.inactiveProfiles = new ArrayList<String>( inactiveProfiles );
306         }
307         else
308         {
309             this.inactiveProfiles = null;
310         }
311 
312         return this;
313     }
314 
315     public MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
316     {
317         if ( remoteRepositories != null )
318         {
319             this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
320         }
321         else
322         {
323             this.remoteRepositories = null;
324         }
325 
326         return this;
327     }
328 
329     public MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
330     {
331         if ( pluginArtifactRepositories != null )
332         {
333             this.pluginArtifactRepositories = new ArrayList<ArtifactRepository>( pluginArtifactRepositories );
334         }
335         else
336         {
337             this.pluginArtifactRepositories = null;
338         }
339 
340         return this;
341     }
342 
343     public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration )
344     {
345         this.projectBuildingRequest = projectBuildingConfiguration;
346     }
347 
348     public List<String> getActiveProfiles()
349     {
350         if ( activeProfiles == null )
351         {
352             activeProfiles = new ArrayList<String>();
353         }
354         return activeProfiles;
355     }
356 
357     public List<String> getInactiveProfiles()
358     {
359         if ( inactiveProfiles == null )
360         {
361             inactiveProfiles = new ArrayList<String>();
362         }
363         return inactiveProfiles;
364     }
365 
366     public TransferListener getTransferListener()
367     {
368         return transferListener;
369     }
370 
371     public int getLoggingLevel()
372     {
373         return loggingLevel;
374     }
375 
376     public boolean isOffline()
377     {
378         return offline;
379     }
380 
381     public boolean isUpdateSnapshots()
382     {
383         return updateSnapshots;
384     }
385 
386     public boolean isNoSnapshotUpdates()
387     {
388         return noSnapshotUpdates;
389     }
390 
391     public String getGlobalChecksumPolicy()
392     {
393         return globalChecksumPolicy;
394     }
395 
396     public boolean isRecursive()
397     {
398         return recursive;
399     }
400 
401     // ----------------------------------------------------------------------
402     //
403     // ----------------------------------------------------------------------
404 
405     public MavenExecutionRequest setBaseDirectory( File basedir )
406     {
407         this.basedir = basedir;
408 
409         return this;
410     }
411 
412     public MavenExecutionRequest setStartTime( Date startTime )
413     {
414         this.startTime = startTime;
415 
416         return this;
417     }
418 
419     public MavenExecutionRequest setShowErrors( boolean showErrors )
420     {
421         this.showErrors = showErrors;
422 
423         return this;
424     }
425 
426     public MavenExecutionRequest setGoals( List<String> goals )
427     {
428         if ( goals != null )
429         {
430             this.goals = new ArrayList<String>( goals );
431         }
432         else
433         {
434             this.goals = null;
435         }
436 
437         return this;
438     }
439 
440     public MavenExecutionRequest setLocalRepository( ArtifactRepository localRepository )
441     {
442         this.localRepository = localRepository;
443 
444         if ( localRepository != null )
445         {
446             setLocalRepositoryPath( new File( localRepository.getBasedir() ).getAbsoluteFile() );
447         }
448 
449         return this;
450     }
451 
452     public MavenExecutionRequest setLocalRepositoryPath( File localRepository )
453     {
454         localRepositoryPath = localRepository;
455 
456         return this;
457     }
458 
459     public MavenExecutionRequest setLocalRepositoryPath( String localRepository )
460     {
461         localRepositoryPath = ( localRepository != null ) ? new File( localRepository ) : null;
462 
463         return this;
464     }
465 
466     public MavenExecutionRequest setSystemProperties( Properties properties )
467     {
468         if ( properties != null )
469         {
470             this.systemProperties = new Properties();
471             this.systemProperties.putAll( properties );
472         }
473         else
474         {
475             this.systemProperties = null;
476         }
477 
478         return this;
479     }
480 
481     public MavenExecutionRequest setUserProperties( Properties userProperties )
482     {
483         if ( userProperties != null )
484         {
485             this.userProperties = new Properties();
486             this.userProperties.putAll( userProperties );
487         }
488         else
489         {
490             this.userProperties = null;
491         }
492 
493         return this;
494     }
495 
496     public MavenExecutionRequest setReactorFailureBehavior( String failureBehavior )
497     {
498         reactorFailureBehavior = failureBehavior;
499 
500         return this;
501     }
502 
503     public MavenExecutionRequest setSelectedProjects( List<String> selectedProjects )
504     {
505         if ( selectedProjects != null )
506         {
507             this.selectedProjects = new ArrayList<String>( selectedProjects );
508         }
509         else
510         {
511             this.selectedProjects = null;
512         }
513 
514         return this;
515     }
516 
517     public MavenExecutionRequest setResumeFrom( String project )
518     {
519         this.resumeFrom = project;
520 
521         return this;
522     }
523 
524     public MavenExecutionRequest setMakeBehavior( String makeBehavior )
525     {
526         this.makeBehavior = makeBehavior;
527 
528         return this;
529     }
530 
531     public MavenExecutionRequest addActiveProfile( String profile )
532     {
533         if ( !getActiveProfiles().contains( profile ) )
534         {
535             getActiveProfiles().add( profile );
536         }
537 
538         return this;
539     }
540 
541     public MavenExecutionRequest addInactiveProfile( String profile )
542     {
543         if ( !getInactiveProfiles().contains( profile ) )
544         {
545             getInactiveProfiles().add( profile );
546         }
547 
548         return this;
549     }
550 
551     public MavenExecutionRequest addActiveProfiles( List<String> profiles )
552     {
553         for ( String profile : profiles )
554         {
555             addActiveProfile( profile );
556         }
557 
558         return this;
559     }
560 
561     public MavenExecutionRequest addInactiveProfiles( List<String> profiles )
562     {
563         for ( String profile : profiles )
564         {
565             addInactiveProfile( profile );
566         }
567 
568         return this;
569     }
570 
571     public MavenExecutionRequest setUseReactor( boolean reactorActive )
572     {
573         useReactor = reactorActive;
574 
575         return this;
576     }
577 
578     public boolean useReactor()
579     {
580         return useReactor;
581     }
582 
583     /** @deprecated use {@link #setPom(File)} */
584     public MavenExecutionRequest setPomFile( String pomFilename )
585     {
586         if ( pomFilename != null )
587         {
588             pom = new File( pomFilename );
589         }
590 
591         return this;
592     }
593 
594     public MavenExecutionRequest setPom( File pom )
595     {
596         this.pom = pom;
597 
598         return this;
599     }
600 
601     public MavenExecutionRequest setInteractiveMode( boolean interactive )
602     {
603         interactiveMode = interactive;
604 
605         return this;
606     }
607 
608     public MavenExecutionRequest setTransferListener( TransferListener transferListener )
609     {
610         this.transferListener = transferListener;
611 
612         return this;
613     }
614 
615     public MavenExecutionRequest setLoggingLevel( int loggingLevel )
616     {
617         this.loggingLevel = loggingLevel;
618 
619         return this;
620     }
621 
622     public MavenExecutionRequest setOffline( boolean offline )
623     {
624         this.offline = offline;
625 
626         return this;
627     }
628 
629     public MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots )
630     {
631         this.updateSnapshots = updateSnapshots;
632 
633         return this;
634     }
635 
636     public MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates )
637     {
638         this.noSnapshotUpdates = noSnapshotUpdates;
639 
640         return this;
641     }
642 
643     public MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy )
644     {
645         this.globalChecksumPolicy = globalChecksumPolicy;
646 
647         return this;
648     }
649 
650     // ----------------------------------------------------------------------------
651     // Settings equivalents
652     // ----------------------------------------------------------------------------
653 
654     public List<Proxy> getProxies()
655     {
656         if ( proxies == null )
657         {
658             proxies = new ArrayList<Proxy>();
659         }
660         return proxies;
661     }
662 
663     public MavenExecutionRequest setProxies( List<Proxy> proxies )
664     {
665         if ( proxies != null )
666         {
667             this.proxies = new ArrayList<Proxy>( proxies );
668         }
669         else
670         {
671             this.proxies = null;
672         }
673 
674         return this;
675     }
676 
677     public MavenExecutionRequest addProxy( Proxy proxy )
678     {
679         if ( proxy == null )
680         {
681             throw new IllegalArgumentException( "proxy missing" );
682         }
683 
684         for ( Proxy p : getProxies() )
685         {
686             if ( p.getId() != null && p.getId().equals( proxy.getId() ) )
687             {
688                 return this;
689             }
690         }
691 
692         getProxies().add( proxy );
693 
694         return this;
695     }
696 
697     public List<Server> getServers()
698     {
699         if ( servers == null )
700         {
701             servers = new ArrayList<Server>();
702         }
703         return servers;
704     }
705 
706     public MavenExecutionRequest setServers( List<Server> servers )
707     {
708         if ( servers != null )
709         {
710             this.servers = new ArrayList<Server>( servers );
711         }
712         else
713         {
714             this.servers = null;
715         }
716 
717         return this;
718     }
719 
720     public MavenExecutionRequest addServer( Server server )
721     {
722         if ( server == null )
723         {
724             throw new IllegalArgumentException( "server missing" );
725         }
726 
727         for ( Server p : getServers() )
728         {
729             if ( p.getId() != null && p.getId().equals( server.getId() ) )
730             {
731                 return this;
732             }
733         }
734 
735         getServers().add( server );
736 
737         return this;
738     }
739 
740     public List<Mirror> getMirrors()
741     {
742         if ( mirrors == null )
743         {
744             mirrors = new ArrayList<Mirror>();
745         }
746         return mirrors;
747     }
748 
749     public MavenExecutionRequest setMirrors( List<Mirror> mirrors )
750     {
751         if ( mirrors != null )
752         {
753             this.mirrors = new ArrayList<Mirror>( mirrors );
754         }
755         else
756         {
757             this.mirrors = null;
758         }
759 
760         return this;
761     }
762 
763     public MavenExecutionRequest addMirror( Mirror mirror )
764     {
765         if ( mirror == null )
766         {
767             throw new IllegalArgumentException( "mirror missing" );
768         }
769 
770         for ( Mirror p : getMirrors() )
771         {
772             if ( p.getId() != null && p.getId().equals( mirror.getId() ) )
773             {
774                 return this;
775             }
776         }
777 
778         getMirrors().add( mirror );
779 
780         return this;
781     }
782 
783     public List<Profile> getProfiles()
784     {
785         if ( profiles == null )
786         {
787             profiles = new ArrayList<Profile>();
788         }
789         return profiles;
790     }
791 
792     public MavenExecutionRequest setProfiles( List<Profile> profiles )
793     {
794         if ( profiles != null )
795         {
796             this.profiles = new ArrayList<Profile>( profiles );
797         }
798         else
799         {
800             this.profiles = null;
801         }
802 
803         return this;
804     }
805 
806     public List<String> getPluginGroups()
807     {
808         if ( pluginGroups == null )
809         {
810             pluginGroups = new ArrayList<String>();
811         }
812 
813         return pluginGroups;
814     }
815 
816     public MavenExecutionRequest setPluginGroups( List<String> pluginGroups )
817     {
818         if ( pluginGroups != null )
819         {
820             this.pluginGroups = new ArrayList<String>( pluginGroups );
821         }
822         else
823         {
824             this.pluginGroups = null;
825         }
826 
827         return this;
828     }
829 
830     public MavenExecutionRequest addPluginGroup( String pluginGroup )
831     {
832         if ( !getPluginGroups().contains( pluginGroup ) )
833         {
834             getPluginGroups().add( pluginGroup );
835         }
836 
837         return this;
838     }
839 
840     public MavenExecutionRequest addPluginGroups( List<String> pluginGroups )
841     {
842         for ( String pluginGroup : pluginGroups )
843         {
844             addPluginGroup( pluginGroup );
845         }
846 
847         return this;
848     }
849 
850     public MavenExecutionRequest setRecursive( boolean recursive )
851     {
852         this.recursive = recursive;
853 
854         return this;
855     }
856 
857     // calculated from request attributes.
858     private ProjectBuildingRequest projectBuildingRequest;
859 
860     public boolean isProjectPresent()
861     {
862         return isProjectPresent;
863     }
864 
865     public MavenExecutionRequest setProjectPresent( boolean projectPresent )
866     {
867         isProjectPresent = projectPresent;
868 
869         return this;
870     }
871 
872     // Settings files
873 
874     public File getUserSettingsFile()
875     {
876         return userSettingsFile;
877     }
878 
879     public MavenExecutionRequest setUserSettingsFile( File userSettingsFile )
880     {
881         this.userSettingsFile = userSettingsFile;
882 
883         return this;
884     }
885 
886     public File getGlobalSettingsFile()
887     {
888         return globalSettingsFile;
889     }
890 
891     public MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile )
892     {
893         this.globalSettingsFile = globalSettingsFile;
894 
895         return this;
896     }
897 
898     public File getUserToolchainsFile()
899     {
900         return userToolchainsFile;
901     }
902 
903     public MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile )
904     {
905         this.userToolchainsFile = userToolchainsFile;
906 
907         return this;
908     }
909 
910     public MavenExecutionRequest addRemoteRepository( ArtifactRepository repository )
911     {
912         for ( ArtifactRepository repo : getRemoteRepositories() )
913         {
914             if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
915             {
916                 return this;
917             }
918         }
919 
920         getRemoteRepositories().add( repository );
921 
922         return this;
923     }
924 
925     public List<ArtifactRepository> getRemoteRepositories()
926     {
927         if ( remoteRepositories == null )
928         {
929             remoteRepositories = new ArrayList<ArtifactRepository>();
930         }
931         return remoteRepositories;
932     }
933 
934     public MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository )
935     {
936         for ( ArtifactRepository repo : getPluginArtifactRepositories() )
937         {
938             if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
939             {
940                 return this;
941             }
942         }
943 
944         getPluginArtifactRepositories().add( repository );
945 
946         return this;
947     }
948 
949     public List<ArtifactRepository> getPluginArtifactRepositories()
950     {
951         if ( pluginArtifactRepositories == null )
952         {
953             pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
954         }
955         return pluginArtifactRepositories;
956     }
957 
958     //TODO: this does not belong here.
959     public ProjectBuildingRequest getProjectBuildingRequest()
960     {
961         if ( projectBuildingRequest == null )
962         {
963             projectBuildingRequest = new DefaultProjectBuildingRequest();
964             projectBuildingRequest.setLocalRepository( getLocalRepository() );
965             projectBuildingRequest.setSystemProperties( getSystemProperties() );
966             projectBuildingRequest.setUserProperties( getUserProperties() );
967             projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
968             projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
969             projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
970             projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
971             projectBuildingRequest.setProfiles( getProfiles() );
972             projectBuildingRequest.setProcessPlugins( true );
973             projectBuildingRequest.setBuildStartTime( getStartTime() );
974         }
975 
976         return projectBuildingRequest;
977     }
978 
979     public MavenExecutionRequest addProfile( Profile profile )
980     {
981         if ( profile == null )
982         {
983             throw new IllegalArgumentException( "profile missing" );
984         }
985 
986         for ( Profile p : getProfiles() )
987         {
988             if ( p.getId() != null && p.getId().equals( profile.getId() ) )
989             {
990                 return this;
991             }
992         }
993 
994         getProfiles().add( profile );
995 
996         return this;
997     }
998 
999     public RepositoryCache getRepositoryCache()
1000     {
1001         return repositoryCache;
1002     }
1003 
1004     public MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache )
1005     {
1006         this.repositoryCache = repositoryCache;
1007 
1008         return this;
1009     }
1010 
1011     public ExecutionListener getExecutionListener()
1012     {
1013         return executionListener;
1014     }
1015 
1016     public MavenExecutionRequest setExecutionListener( ExecutionListener executionListener )
1017     {
1018         this.executionListener = executionListener;
1019 
1020         return this;
1021     }
1022 
1023     public String getThreadCount()
1024     {
1025         return threadCount;
1026     }
1027 
1028     public void setThreadCount( String threadCount )
1029     {
1030         this.threadCount = threadCount;
1031     }
1032 
1033     public boolean isThreadConfigurationPresent()
1034     {
1035         return getThreadCount() != null;
1036     }
1037 
1038     public boolean isPerCoreThreadCount()
1039     {
1040         return perCoreThreadCount;
1041     }
1042 
1043     public void setPerCoreThreadCount( boolean perCoreThreadCount )
1044     {
1045         this.perCoreThreadCount = perCoreThreadCount;
1046     }
1047 
1048     public WorkspaceReader getWorkspaceReader()
1049     {
1050         return workspaceReader;
1051     }
1052 
1053     public MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader )
1054     {
1055         this.workspaceReader = workspaceReader;
1056         return this;
1057     }
1058 
1059     public boolean isCacheTransferError()
1060     {
1061         return cacheTransferError;
1062     }
1063 
1064     public MavenExecutionRequest setCacheTransferError( boolean cacheTransferError )
1065     {
1066         this.cacheTransferError = cacheTransferError;
1067         return this;
1068     }
1069 
1070     public boolean isCacheNotFound()
1071     {
1072         return cacheNotFound;
1073     }
1074 
1075     public MavenExecutionRequest setCacheNotFound( boolean cacheNotFound )
1076     {
1077         this.cacheNotFound = cacheNotFound;
1078         return this;
1079     }
1080 
1081     public boolean isUseLegacyLocalRepository()
1082     {
1083         return this.useSimpleLocalRepositoryManager;
1084     }
1085 
1086     public MavenExecutionRequest setUseLegacyLocalRepository( boolean useSimpleLocalRepositoryManager )
1087     {
1088         this.useSimpleLocalRepositoryManager = useSimpleLocalRepositoryManager;
1089         return this;
1090     }
1091 }