1 package org.apache.maven.execution;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Date;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Properties;
29
30 import org.apache.commons.lang3.Validate;
31 import org.apache.maven.artifact.repository.ArtifactRepository;
32 import org.apache.maven.eventspy.internal.EventSpyDispatcher;
33 import org.apache.maven.model.Profile;
34 import org.apache.maven.project.DefaultProjectBuildingRequest;
35 import org.apache.maven.project.ProjectBuildingRequest;
36 import org.apache.maven.properties.internal.SystemProperties;
37 import org.apache.maven.settings.Mirror;
38 import org.apache.maven.settings.Proxy;
39 import org.apache.maven.settings.Server;
40 import org.apache.maven.toolchain.model.ToolchainModel;
41 import org.eclipse.aether.DefaultRepositoryCache;
42 import org.eclipse.aether.RepositoryCache;
43 import org.eclipse.aether.repository.WorkspaceReader;
44 import org.eclipse.aether.transfer.TransferListener;
45
46 import com.google.common.collect.Maps;
47
48
49
50
51 public class DefaultMavenExecutionRequest
52 implements MavenExecutionRequest
53 {
54
55 private RepositoryCache repositoryCache = new DefaultRepositoryCache();
56
57 private WorkspaceReader workspaceReader;
58
59 private ArtifactRepository localRepository;
60
61 private EventSpyDispatcher eventSpyDispatcher;
62
63 private File localRepositoryPath;
64
65 private boolean offline = false;
66
67 private boolean interactiveMode = true;
68
69 private boolean cacheTransferError;
70
71 private boolean cacheNotFound;
72
73 private List<Proxy> proxies;
74
75 private List<Server> servers;
76
77 private List<Mirror> mirrors;
78
79 private List<Profile> profiles;
80
81 private List<String> pluginGroups;
82
83 private boolean isProjectPresent = true;
84
85
86
87
88
89
90
91 private File userSettingsFile;
92
93 private File globalSettingsFile;
94
95 private File userToolchainsFile;
96
97 private File globalToolchainsFile;
98
99
100
101
102
103 private File multiModuleProjectDirectory;
104
105 private File basedir;
106
107 private List<String> goals;
108
109 private boolean useReactor = false;
110
111 private boolean recursive = true;
112
113 private File pom;
114
115 private String reactorFailureBehavior = REACTOR_FAIL_FAST;
116
117 private List<String> selectedProjects;
118
119 private List<String> excludedProjects;
120
121 private String resumeFrom;
122
123 private String makeBehavior;
124
125 private Properties systemProperties;
126
127 private Properties userProperties;
128
129 private Date startTime;
130
131 private boolean showErrors = false;
132
133 private List<String> activeProfiles;
134
135 private List<String> inactiveProfiles;
136
137 private TransferListener transferListener;
138
139 private int loggingLevel = LOGGING_LEVEL_INFO;
140
141 private String globalChecksumPolicy;
142
143 private boolean updateSnapshots = false;
144
145 private List<ArtifactRepository> remoteRepositories;
146
147 private List<ArtifactRepository> pluginArtifactRepositories;
148
149 private ExecutionListener executionListener;
150
151 private int degreeOfConcurrency = 1;
152
153 private String builderId = "singlethreaded";
154
155 private Map<String, List<ToolchainModel>> toolchains;
156
157
158
159
160
161
162 private boolean noSnapshotUpdates;
163
164 private boolean useLegacyLocalRepositoryManager = false;
165
166 private Map<String, Object> data;
167
168 public DefaultMavenExecutionRequest()
169 {
170 }
171
172 public static MavenExecutionRequest copy( MavenExecutionRequest original )
173 {
174 DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest();
175 copy.setLocalRepository( original.getLocalRepository() );
176 copy.setLocalRepositoryPath( original.getLocalRepositoryPath() );
177 copy.setOffline( original.isOffline() );
178 copy.setInteractiveMode( original.isInteractiveMode() );
179 copy.setCacheNotFound( original.isCacheNotFound() );
180 copy.setCacheTransferError( original.isCacheTransferError() );
181 copy.setProxies( original.getProxies() );
182 copy.setServers( original.getServers() );
183 copy.setMirrors( original.getMirrors() );
184 copy.setProfiles( original.getProfiles() );
185 copy.setPluginGroups( original.getPluginGroups() );
186 copy.setProjectPresent( original.isProjectPresent() );
187 copy.setUserSettingsFile( original.getUserSettingsFile() );
188 copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
189 copy.setUserToolchainsFile( original.getUserToolchainsFile() );
190 copy.setGlobalToolchainsFile( original.getGlobalToolchainsFile() );
191 copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() )
192 : null );
193 copy.setGoals( original.getGoals() );
194 copy.setRecursive( original.isRecursive() );
195 copy.setPom( original.getPom() );
196 copy.setSystemProperties( original.getSystemProperties() );
197 copy.setUserProperties( original.getUserProperties() );
198 copy.setShowErrors( original.isShowErrors() );
199 copy.setActiveProfiles( original.getActiveProfiles() );
200 copy.setInactiveProfiles( original.getInactiveProfiles() );
201 copy.setTransferListener( original.getTransferListener() );
202 copy.setLoggingLevel( original.getLoggingLevel() );
203 copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy() );
204 copy.setUpdateSnapshots( original.isUpdateSnapshots() );
205 copy.setRemoteRepositories( original.getRemoteRepositories() );
206 copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
207 copy.setRepositoryCache( original.getRepositoryCache() );
208 copy.setWorkspaceReader( original.getWorkspaceReader() );
209 copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
210 copy.setExecutionListener( original.getExecutionListener() );
211 copy.setUseLegacyLocalRepository( original.isUseLegacyLocalRepository() );
212 copy.setBuilderId( original.getBuilderId() );
213 return copy;
214 }
215
216 @Override
217 public String getBaseDirectory()
218 {
219 if ( basedir == null )
220 {
221 return null;
222 }
223
224 return basedir.getAbsolutePath();
225 }
226
227 @Override
228 public ArtifactRepository getLocalRepository()
229 {
230 return localRepository;
231 }
232
233 @Override
234 public File getLocalRepositoryPath()
235 {
236 return localRepositoryPath;
237 }
238
239 @Override
240 public List<String> getGoals()
241 {
242 if ( goals == null )
243 {
244 goals = new ArrayList<>();
245 }
246 return goals;
247 }
248
249 @Override
250 public Properties getSystemProperties()
251 {
252 if ( systemProperties == null )
253 {
254 systemProperties = new Properties();
255 }
256
257 return systemProperties;
258 }
259
260 @Override
261 public Properties getUserProperties()
262 {
263 if ( userProperties == null )
264 {
265 userProperties = new Properties();
266 }
267
268 return userProperties;
269 }
270
271 @Override
272 public File getPom()
273 {
274 return pom;
275 }
276
277 @Override
278 public String getReactorFailureBehavior()
279 {
280 return reactorFailureBehavior;
281 }
282
283 @Override
284 public List<String> getSelectedProjects()
285 {
286 if ( selectedProjects == null )
287 {
288 selectedProjects = new ArrayList<>();
289 }
290
291 return selectedProjects;
292 }
293
294 @Override
295 public List<String> getExcludedProjects()
296 {
297 if ( excludedProjects == null )
298 {
299 excludedProjects = new ArrayList<>();
300 }
301
302 return excludedProjects;
303 }
304
305 @Override
306 public String getResumeFrom()
307 {
308 return resumeFrom;
309 }
310
311 @Override
312 public String getMakeBehavior()
313 {
314 return makeBehavior;
315 }
316
317 @Override
318 public Date getStartTime()
319 {
320 return startTime;
321 }
322
323 @Override
324 public boolean isShowErrors()
325 {
326 return showErrors;
327 }
328
329 @Override
330 public boolean isInteractiveMode()
331 {
332 return interactiveMode;
333 }
334
335 @Override
336 public MavenExecutionRequest setActiveProfiles( List<String> activeProfiles )
337 {
338 if ( activeProfiles != null )
339 {
340 this.activeProfiles = new ArrayList<>( activeProfiles );
341 }
342 else
343 {
344 this.activeProfiles = null;
345 }
346
347 return this;
348 }
349
350 @Override
351 public MavenExecutionRequest setInactiveProfiles( List<String> inactiveProfiles )
352 {
353 if ( inactiveProfiles != null )
354 {
355 this.inactiveProfiles = new ArrayList<>( inactiveProfiles );
356 }
357 else
358 {
359 this.inactiveProfiles = null;
360 }
361
362 return this;
363 }
364
365 @Override
366 public MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
367 {
368 if ( remoteRepositories != null )
369 {
370 this.remoteRepositories = new ArrayList<>( remoteRepositories );
371 }
372 else
373 {
374 this.remoteRepositories = null;
375 }
376
377 return this;
378 }
379
380 @Override
381 public MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
382 {
383 if ( pluginArtifactRepositories != null )
384 {
385 this.pluginArtifactRepositories = new ArrayList<>( pluginArtifactRepositories );
386 }
387 else
388 {
389 this.pluginArtifactRepositories = null;
390 }
391
392 return this;
393 }
394
395 public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration )
396 {
397 this.projectBuildingRequest = projectBuildingConfiguration;
398 }
399
400 @Override
401 public List<String> getActiveProfiles()
402 {
403 if ( activeProfiles == null )
404 {
405 activeProfiles = new ArrayList<>();
406 }
407 return activeProfiles;
408 }
409
410 @Override
411 public List<String> getInactiveProfiles()
412 {
413 if ( inactiveProfiles == null )
414 {
415 inactiveProfiles = new ArrayList<>();
416 }
417 return inactiveProfiles;
418 }
419
420 @Override
421 public TransferListener getTransferListener()
422 {
423 return transferListener;
424 }
425
426 @Override
427 public int getLoggingLevel()
428 {
429 return loggingLevel;
430 }
431
432 @Override
433 public boolean isOffline()
434 {
435 return offline;
436 }
437
438 @Override
439 public boolean isUpdateSnapshots()
440 {
441 return updateSnapshots;
442 }
443
444 @Override
445 public boolean isNoSnapshotUpdates()
446 {
447 return noSnapshotUpdates;
448 }
449
450 @Override
451 public String getGlobalChecksumPolicy()
452 {
453 return globalChecksumPolicy;
454 }
455
456 @Override
457 public boolean isRecursive()
458 {
459 return recursive;
460 }
461
462
463
464
465
466 @Override
467 public MavenExecutionRequest setBaseDirectory( File basedir )
468 {
469 this.basedir = basedir;
470
471 return this;
472 }
473
474 @Override
475 public MavenExecutionRequest setStartTime( Date startTime )
476 {
477 this.startTime = startTime;
478
479 return this;
480 }
481
482 @Override
483 public MavenExecutionRequest setShowErrors( boolean showErrors )
484 {
485 this.showErrors = showErrors;
486
487 return this;
488 }
489
490 @Override
491 public MavenExecutionRequest setGoals( List<String> goals )
492 {
493 if ( goals != null )
494 {
495 this.goals = new ArrayList<>( goals );
496 }
497 else
498 {
499 this.goals = null;
500 }
501
502 return this;
503 }
504
505 @Override
506 public MavenExecutionRequest setLocalRepository( ArtifactRepository localRepository )
507 {
508 this.localRepository = localRepository;
509
510 if ( localRepository != null )
511 {
512 setLocalRepositoryPath( new File( localRepository.getBasedir() ).getAbsoluteFile() );
513 }
514
515 return this;
516 }
517
518 @Override
519 public MavenExecutionRequest setLocalRepositoryPath( File localRepository )
520 {
521 localRepositoryPath = localRepository;
522
523 return this;
524 }
525
526 @Override
527 public MavenExecutionRequest setLocalRepositoryPath( String localRepository )
528 {
529 localRepositoryPath = ( localRepository != null ) ? new File( localRepository ) : null;
530
531 return this;
532 }
533
534 @Override
535 public MavenExecutionRequest setSystemProperties( Properties properties )
536 {
537 if ( properties != null )
538 {
539 this.systemProperties = SystemProperties.copyProperties( properties );
540 }
541 else
542 {
543 this.systemProperties = null;
544 }
545
546 return this;
547 }
548
549 @Override
550 public MavenExecutionRequest setUserProperties( Properties userProperties )
551 {
552 if ( userProperties != null )
553 {
554 this.userProperties = new Properties();
555 this.userProperties.putAll( userProperties );
556 }
557 else
558 {
559 this.userProperties = null;
560 }
561
562 return this;
563 }
564
565 @Override
566 public MavenExecutionRequest setReactorFailureBehavior( String failureBehavior )
567 {
568 reactorFailureBehavior = failureBehavior;
569
570 return this;
571 }
572
573 @Override
574 public MavenExecutionRequest setSelectedProjects( List<String> selectedProjects )
575 {
576 if ( selectedProjects != null )
577 {
578 this.selectedProjects = new ArrayList<>( selectedProjects );
579 }
580 else
581 {
582 this.selectedProjects = null;
583 }
584
585 return this;
586 }
587
588 @Override
589 public MavenExecutionRequest setExcludedProjects( List<String> excludedProjects )
590 {
591 if ( excludedProjects != null )
592 {
593 this.excludedProjects = new ArrayList<>( excludedProjects );
594 }
595 else
596 {
597 this.excludedProjects = null;
598 }
599
600 return this;
601 }
602
603 @Override
604 public MavenExecutionRequest setResumeFrom( String project )
605 {
606 this.resumeFrom = project;
607
608 return this;
609 }
610
611 @Override
612 public MavenExecutionRequest setMakeBehavior( String makeBehavior )
613 {
614 this.makeBehavior = makeBehavior;
615
616 return this;
617 }
618
619 @Override
620 public MavenExecutionRequest addActiveProfile( String profile )
621 {
622 if ( !getActiveProfiles().contains( profile ) )
623 {
624 getActiveProfiles().add( profile );
625 }
626
627 return this;
628 }
629
630 @Override
631 public MavenExecutionRequest addInactiveProfile( String profile )
632 {
633 if ( !getInactiveProfiles().contains( profile ) )
634 {
635 getInactiveProfiles().add( profile );
636 }
637
638 return this;
639 }
640
641 @Override
642 public MavenExecutionRequest addActiveProfiles( List<String> profiles )
643 {
644 for ( String profile : profiles )
645 {
646 addActiveProfile( profile );
647 }
648
649 return this;
650 }
651
652 @Override
653 public MavenExecutionRequest addInactiveProfiles( List<String> profiles )
654 {
655 for ( String profile : profiles )
656 {
657 addInactiveProfile( profile );
658 }
659
660 return this;
661 }
662
663 public MavenExecutionRequest setUseReactor( boolean reactorActive )
664 {
665 useReactor = reactorActive;
666
667 return this;
668 }
669
670 public boolean useReactor()
671 {
672 return useReactor;
673 }
674
675
676 @Deprecated
677 public MavenExecutionRequest setPomFile( String pomFilename )
678 {
679 if ( pomFilename != null )
680 {
681 pom = new File( pomFilename );
682 }
683
684 return this;
685 }
686
687 @Override
688 public MavenExecutionRequest setPom( File pom )
689 {
690 this.pom = pom;
691
692 return this;
693 }
694
695 @Override
696 public MavenExecutionRequest setInteractiveMode( boolean interactive )
697 {
698 interactiveMode = interactive;
699
700 return this;
701 }
702
703 @Override
704 public MavenExecutionRequest setTransferListener( TransferListener transferListener )
705 {
706 this.transferListener = transferListener;
707
708 return this;
709 }
710
711 @Override
712 public MavenExecutionRequest setLoggingLevel( int loggingLevel )
713 {
714 this.loggingLevel = loggingLevel;
715
716 return this;
717 }
718
719 @Override
720 public MavenExecutionRequest setOffline( boolean offline )
721 {
722 this.offline = offline;
723
724 return this;
725 }
726
727 @Override
728 public MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots )
729 {
730 this.updateSnapshots = updateSnapshots;
731
732 return this;
733 }
734
735 @Override
736 public MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates )
737 {
738 this.noSnapshotUpdates = noSnapshotUpdates;
739
740 return this;
741 }
742
743 @Override
744 public MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy )
745 {
746 this.globalChecksumPolicy = globalChecksumPolicy;
747
748 return this;
749 }
750
751
752
753
754
755 @Override
756 public List<Proxy> getProxies()
757 {
758 if ( proxies == null )
759 {
760 proxies = new ArrayList<>();
761 }
762 return proxies;
763 }
764
765 @Override
766 public MavenExecutionRequest setProxies( List<Proxy> proxies )
767 {
768 if ( proxies != null )
769 {
770 this.proxies = new ArrayList<>( proxies );
771 }
772 else
773 {
774 this.proxies = null;
775 }
776
777 return this;
778 }
779
780 @Override
781 public MavenExecutionRequest addProxy( Proxy proxy )
782 {
783 Validate.notNull( proxy, "proxy cannot be null" );
784
785 for ( Proxy p : getProxies() )
786 {
787 if ( p.getId() != null && p.getId().equals( proxy.getId() ) )
788 {
789 return this;
790 }
791 }
792
793 getProxies().add( proxy );
794
795 return this;
796 }
797
798 @Override
799 public List<Server> getServers()
800 {
801 if ( servers == null )
802 {
803 servers = new ArrayList<>();
804 }
805 return servers;
806 }
807
808 @Override
809 public MavenExecutionRequest setServers( List<Server> servers )
810 {
811 if ( servers != null )
812 {
813 this.servers = new ArrayList<>( servers );
814 }
815 else
816 {
817 this.servers = null;
818 }
819
820 return this;
821 }
822
823 @Override
824 public MavenExecutionRequest addServer( Server server )
825 {
826 Validate.notNull( server, "server cannot be null" );
827
828 for ( Server p : getServers() )
829 {
830 if ( p.getId() != null && p.getId().equals( server.getId() ) )
831 {
832 return this;
833 }
834 }
835
836 getServers().add( server );
837
838 return this;
839 }
840
841 @Override
842 public List<Mirror> getMirrors()
843 {
844 if ( mirrors == null )
845 {
846 mirrors = new ArrayList<>();
847 }
848 return mirrors;
849 }
850
851 @Override
852 public MavenExecutionRequest setMirrors( List<Mirror> mirrors )
853 {
854 if ( mirrors != null )
855 {
856 this.mirrors = new ArrayList<>( mirrors );
857 }
858 else
859 {
860 this.mirrors = null;
861 }
862
863 return this;
864 }
865
866 @Override
867 public MavenExecutionRequest addMirror( Mirror mirror )
868 {
869 Validate.notNull( mirror, "mirror cannot be null" );
870
871 for ( Mirror p : getMirrors() )
872 {
873 if ( p.getId() != null && p.getId().equals( mirror.getId() ) )
874 {
875 return this;
876 }
877 }
878
879 getMirrors().add( mirror );
880
881 return this;
882 }
883
884 @Override
885 public List<Profile> getProfiles()
886 {
887 if ( profiles == null )
888 {
889 profiles = new ArrayList<>();
890 }
891 return profiles;
892 }
893
894 @Override
895 public MavenExecutionRequest setProfiles( List<Profile> profiles )
896 {
897 if ( profiles != null )
898 {
899 this.profiles = new ArrayList<>( profiles );
900 }
901 else
902 {
903 this.profiles = null;
904 }
905
906 return this;
907 }
908
909 @Override
910 public List<String> getPluginGroups()
911 {
912 if ( pluginGroups == null )
913 {
914 pluginGroups = new ArrayList<>();
915 }
916
917 return pluginGroups;
918 }
919
920 @Override
921 public MavenExecutionRequest setPluginGroups( List<String> pluginGroups )
922 {
923 if ( pluginGroups != null )
924 {
925 this.pluginGroups = new ArrayList<>( pluginGroups );
926 }
927 else
928 {
929 this.pluginGroups = null;
930 }
931
932 return this;
933 }
934
935 @Override
936 public MavenExecutionRequest addPluginGroup( String pluginGroup )
937 {
938 if ( !getPluginGroups().contains( pluginGroup ) )
939 {
940 getPluginGroups().add( pluginGroup );
941 }
942
943 return this;
944 }
945
946 @Override
947 public MavenExecutionRequest addPluginGroups( List<String> pluginGroups )
948 {
949 for ( String pluginGroup : pluginGroups )
950 {
951 addPluginGroup( pluginGroup );
952 }
953
954 return this;
955 }
956
957 @Override
958 public MavenExecutionRequest setRecursive( boolean recursive )
959 {
960 this.recursive = recursive;
961
962 return this;
963 }
964
965
966 private ProjectBuildingRequest projectBuildingRequest;
967
968 @Override
969 public boolean isProjectPresent()
970 {
971 return isProjectPresent;
972 }
973
974 @Override
975 public MavenExecutionRequest setProjectPresent( boolean projectPresent )
976 {
977 isProjectPresent = projectPresent;
978
979 return this;
980 }
981
982
983
984 @Override
985 public File getUserSettingsFile()
986 {
987 return userSettingsFile;
988 }
989
990 @Override
991 public MavenExecutionRequest setUserSettingsFile( File userSettingsFile )
992 {
993 this.userSettingsFile = userSettingsFile;
994
995 return this;
996 }
997
998 @Override
999 public File getGlobalSettingsFile()
1000 {
1001 return globalSettingsFile;
1002 }
1003
1004 @Override
1005 public MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile )
1006 {
1007 this.globalSettingsFile = globalSettingsFile;
1008
1009 return this;
1010 }
1011
1012 @Override
1013 public File getUserToolchainsFile()
1014 {
1015 return userToolchainsFile;
1016 }
1017
1018 @Override
1019 public MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile )
1020 {
1021 this.userToolchainsFile = userToolchainsFile;
1022
1023 return this;
1024 }
1025
1026 @Override
1027 public File getGlobalToolchainsFile()
1028 {
1029 return globalToolchainsFile;
1030 }
1031
1032 @Override
1033 public MavenExecutionRequest setGlobalToolchainsFile( File globalToolchainsFile )
1034 {
1035 this.globalToolchainsFile = globalToolchainsFile;
1036 return this;
1037 }
1038
1039 @Override
1040 public MavenExecutionRequest addRemoteRepository( ArtifactRepository repository )
1041 {
1042 for ( ArtifactRepository repo : getRemoteRepositories() )
1043 {
1044 if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
1045 {
1046 return this;
1047 }
1048 }
1049
1050 getRemoteRepositories().add( repository );
1051
1052 return this;
1053 }
1054
1055 @Override
1056 public List<ArtifactRepository> getRemoteRepositories()
1057 {
1058 if ( remoteRepositories == null )
1059 {
1060 remoteRepositories = new ArrayList<>();
1061 }
1062 return remoteRepositories;
1063 }
1064
1065 @Override
1066 public MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository )
1067 {
1068 for ( ArtifactRepository repo : getPluginArtifactRepositories() )
1069 {
1070 if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
1071 {
1072 return this;
1073 }
1074 }
1075
1076 getPluginArtifactRepositories().add( repository );
1077
1078 return this;
1079 }
1080
1081 @Override
1082 public List<ArtifactRepository> getPluginArtifactRepositories()
1083 {
1084 if ( pluginArtifactRepositories == null )
1085 {
1086 pluginArtifactRepositories = new ArrayList<>();
1087 }
1088 return pluginArtifactRepositories;
1089 }
1090
1091
1092 @Override
1093 public ProjectBuildingRequest getProjectBuildingRequest()
1094 {
1095 if ( projectBuildingRequest == null )
1096 {
1097 projectBuildingRequest = new DefaultProjectBuildingRequest();
1098 projectBuildingRequest.setLocalRepository( getLocalRepository() );
1099 projectBuildingRequest.setSystemProperties( getSystemProperties() );
1100 projectBuildingRequest.setUserProperties( getUserProperties() );
1101 projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
1102 projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
1103 projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
1104 projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
1105 projectBuildingRequest.setProfiles( getProfiles() );
1106 projectBuildingRequest.setProcessPlugins( true );
1107 projectBuildingRequest.setBuildStartTime( getStartTime() );
1108 }
1109
1110 return projectBuildingRequest;
1111 }
1112
1113 @Override
1114 public MavenExecutionRequest addProfile( Profile profile )
1115 {
1116 Validate.notNull( profile, "profile cannot be null" );
1117
1118 for ( Profile p : getProfiles() )
1119 {
1120 if ( p.getId() != null && p.getId().equals( profile.getId() ) )
1121 {
1122 return this;
1123 }
1124 }
1125
1126 getProfiles().add( profile );
1127
1128 return this;
1129 }
1130
1131 @Override
1132 public RepositoryCache getRepositoryCache()
1133 {
1134 return repositoryCache;
1135 }
1136
1137 @Override
1138 public MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache )
1139 {
1140 this.repositoryCache = repositoryCache;
1141
1142 return this;
1143 }
1144
1145 @Override
1146 public ExecutionListener getExecutionListener()
1147 {
1148 return executionListener;
1149 }
1150
1151 @Override
1152 public MavenExecutionRequest setExecutionListener( ExecutionListener executionListener )
1153 {
1154 this.executionListener = executionListener;
1155
1156 return this;
1157 }
1158
1159 @Override
1160 public void setDegreeOfConcurrency( final int degreeOfConcurrency )
1161 {
1162 this.degreeOfConcurrency = degreeOfConcurrency;
1163 }
1164
1165 @Override
1166 public int getDegreeOfConcurrency()
1167 {
1168 return degreeOfConcurrency;
1169 }
1170
1171 @Override
1172 public WorkspaceReader getWorkspaceReader()
1173 {
1174 return workspaceReader;
1175 }
1176
1177 @Override
1178 public MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader )
1179 {
1180 this.workspaceReader = workspaceReader;
1181 return this;
1182 }
1183
1184 @Override
1185 public boolean isCacheTransferError()
1186 {
1187 return cacheTransferError;
1188 }
1189
1190 @Override
1191 public MavenExecutionRequest setCacheTransferError( boolean cacheTransferError )
1192 {
1193 this.cacheTransferError = cacheTransferError;
1194 return this;
1195 }
1196
1197 @Override
1198 public boolean isCacheNotFound()
1199 {
1200 return cacheNotFound;
1201 }
1202
1203 @Override
1204 public MavenExecutionRequest setCacheNotFound( boolean cacheNotFound )
1205 {
1206 this.cacheNotFound = cacheNotFound;
1207 return this;
1208 }
1209
1210 @Override
1211 public boolean isUseLegacyLocalRepository()
1212 {
1213 return this.useLegacyLocalRepositoryManager;
1214 }
1215
1216 @Override
1217 public MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepositoryManager )
1218 {
1219 this.useLegacyLocalRepositoryManager = useLegacyLocalRepositoryManager;
1220 return this;
1221 }
1222
1223 @Override
1224 public MavenExecutionRequest setBuilderId( String builderId )
1225 {
1226 this.builderId = builderId;
1227 return this;
1228 }
1229
1230 @Override
1231 public String getBuilderId()
1232 {
1233 return builderId;
1234 }
1235
1236 @Override
1237 public Map<String, List<ToolchainModel>> getToolchains()
1238 {
1239 if ( toolchains == null )
1240 {
1241 toolchains = new HashMap<>();
1242 }
1243 return toolchains;
1244 }
1245
1246 @Override
1247 public MavenExecutionRequest setToolchains( Map<String, List<ToolchainModel>> toolchains )
1248 {
1249 this.toolchains = toolchains;
1250 return this;
1251 }
1252
1253 @Override
1254 public void setMultiModuleProjectDirectory( File directory )
1255 {
1256 this.multiModuleProjectDirectory = directory;
1257 }
1258
1259 @Override
1260 public File getMultiModuleProjectDirectory()
1261 {
1262 return multiModuleProjectDirectory;
1263 }
1264
1265 @Override
1266 public MavenExecutionRequest setEventSpyDispatcher( EventSpyDispatcher eventSpyDispatcher )
1267 {
1268 this.eventSpyDispatcher = eventSpyDispatcher;
1269 return this;
1270 }
1271
1272 @Override
1273 public EventSpyDispatcher getEventSpyDispatcher()
1274 {
1275 return eventSpyDispatcher;
1276 }
1277
1278 @Override
1279 public Map<String, Object> getData()
1280 {
1281 if ( data == null )
1282 {
1283 data = Maps.newHashMap();
1284 }
1285
1286 return data;
1287 }
1288 }