1 package org.apache.maven.shared.invoker;
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.io.InputStream;
24 import java.util.Collections;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Properties;
29
30
31
32
33
34 public class DefaultInvocationRequest
35 implements InvocationRequest
36 {
37
38 private File basedir;
39
40 private boolean debug;
41
42 private InvocationOutputHandler errorHandler;
43
44 private ReactorFailureBehavior failureBehavior = ReactorFailureBehavior.FailFast;
45
46 private List<String> goals;
47
48 private InputStream inputStream;
49
50 private boolean interactive;
51
52 private File localRepository;
53
54 private boolean offline;
55
56 private boolean recursive = true;
57
58 private InvocationOutputHandler outputHandler;
59
60 private File pomFile;
61
62 private Properties properties;
63
64 private boolean showErrors;
65
66 private boolean updateSnapshots;
67
68 private boolean shellEnvironmentInherited = true;
69
70 private File userSettings;
71
72 private File globalSettings;
73
74 private File toolchains;
75
76 private File globalToolchains;
77
78 private CheckSumPolicy globalChecksumPolicy;
79
80 private String pomFilename;
81
82 private File javaHome;
83
84 private List<String> profiles;
85
86 private boolean nonPluginUpdates;
87
88 private Map<String, String> shellEnvironments;
89
90 private String mavenOpts;
91
92 private List<String> projects;
93
94 private boolean alsoMake;
95
96 private boolean alsoMakeDependents;
97
98 private String resumeFrom;
99
100 private boolean showVersion;
101
102 private String threads;
103
104 private String builderId;
105
106 private int timeoutInSeconds = NO_TIMEOUT;
107
108 private boolean quiet;
109
110
111
112
113
114
115 public File getBaseDirectory()
116 {
117 return basedir;
118 }
119
120
121 public File getBaseDirectory( File defaultDirectory )
122 {
123 return basedir == null ? defaultDirectory : basedir;
124 }
125
126
127 public InvocationOutputHandler getErrorHandler( InvocationOutputHandler defaultHandler )
128 {
129 return errorHandler == null ? defaultHandler : errorHandler;
130 }
131
132
133
134
135
136
137 public ReactorFailureBehavior getReactorFailureBehavior()
138 {
139 return failureBehavior;
140 }
141
142
143
144
145
146
147 public List<String> getGoals()
148 {
149 return goals;
150 }
151
152
153 public InputStream getInputStream( InputStream defaultStream )
154 {
155 return inputStream == null ? defaultStream : inputStream;
156 }
157
158
159 public File getLocalRepositoryDirectory( File defaultDirectory )
160 {
161 return localRepository == null ? defaultDirectory : localRepository;
162 }
163
164
165 public InvocationOutputHandler getOutputHandler( InvocationOutputHandler defaultHandler )
166 {
167 return outputHandler == null ? defaultHandler : outputHandler;
168 }
169
170
171
172
173
174
175 public File getPomFile()
176 {
177 return pomFile;
178 }
179
180
181
182
183
184
185 public Properties getProperties()
186 {
187 return properties;
188 }
189
190
191
192
193
194
195 public boolean isDebug()
196 {
197 return debug;
198 }
199
200
201
202
203
204
205 public boolean isBatchMode()
206 {
207 return interactive;
208 }
209
210
211
212
213
214
215 public boolean isOffline()
216 {
217 return offline;
218 }
219
220
221
222
223
224
225 public boolean isShowErrors()
226 {
227 return showErrors;
228 }
229
230
231
232
233
234
235 public boolean isUpdateSnapshots()
236 {
237 return updateSnapshots;
238 }
239
240
241
242
243
244
245 public boolean isRecursive()
246 {
247 return recursive;
248 }
249
250
251 public InvocationRequest setRecursive( boolean recursive )
252 {
253 this.recursive = recursive;
254 return this;
255 }
256
257
258 public InvocationRequest setBaseDirectory( File basedir )
259 {
260 this.basedir = basedir;
261 return this;
262 }
263
264
265 public InvocationRequest setDebug( boolean debug )
266 {
267 this.debug = debug;
268 return this;
269 }
270
271
272 public InvocationRequest setErrorHandler( InvocationOutputHandler errorHandler )
273 {
274 this.errorHandler = errorHandler;
275 return this;
276 }
277
278
279
280
281
282
283
284 public InvocationRequest setReactorFailureBehavior( ReactorFailureBehavior failureBehavior )
285 {
286 this.failureBehavior = failureBehavior;
287 return this;
288 }
289
290
291 public InvocationRequest setGoals( List<String> goals )
292 {
293 this.goals = goals;
294 return this;
295 }
296
297
298 public InvocationRequest setInputStream( InputStream inputStream )
299 {
300 this.inputStream = inputStream;
301 return this;
302 }
303
304
305 public InvocationRequest setBatchMode( boolean interactive )
306 {
307 this.interactive = interactive;
308 return this;
309 }
310
311
312 public InvocationRequest setLocalRepositoryDirectory( File localRepository )
313 {
314 this.localRepository = localRepository;
315 return this;
316 }
317
318
319 public InvocationRequest setOffline( boolean offline )
320 {
321 this.offline = offline;
322 return this;
323 }
324
325
326 public InvocationRequest setOutputHandler( InvocationOutputHandler outputHandler )
327 {
328 this.outputHandler = outputHandler;
329 return this;
330 }
331
332
333 public InvocationRequest setPomFile( File pomFile )
334 {
335 this.pomFile = pomFile;
336 return this;
337 }
338
339
340 public InvocationRequest setProperties( Properties properties )
341 {
342 this.properties = properties;
343 return this;
344 }
345
346
347 public InvocationRequest setShowErrors( boolean showErrors )
348 {
349 this.showErrors = showErrors;
350 return this;
351 }
352
353
354 public InvocationRequest setUpdateSnapshots( boolean updateSnapshots )
355 {
356 this.updateSnapshots = updateSnapshots;
357 return this;
358 }
359
360
361
362
363
364
365
366 public boolean isShellEnvironmentInherited()
367 {
368 return shellEnvironmentInherited;
369 }
370
371
372 public InvocationRequest setShellEnvironmentInherited( boolean shellEnvironmentInherited )
373 {
374 this.shellEnvironmentInherited = shellEnvironmentInherited;
375 return this;
376 }
377
378
379
380
381
382
383 public File getJavaHome()
384 {
385 return javaHome;
386 }
387
388
389 public InvocationRequest setJavaHome( File javaHome )
390 {
391 this.javaHome = javaHome;
392 return this;
393 }
394
395
396
397
398
399
400 public File getUserSettingsFile()
401 {
402 return userSettings;
403 }
404
405
406 public InvocationRequest setUserSettingsFile( File userSettings )
407 {
408 this.userSettings = userSettings;
409 return this;
410 }
411
412
413
414
415
416
417 public File getGlobalSettingsFile()
418 {
419 return globalSettings;
420 }
421
422
423 public InvocationRequest setGlobalSettingsFile( File globalSettings )
424 {
425 this.globalSettings = globalSettings;
426 return this;
427 }
428
429
430
431
432
433
434 public File getToolchainsFile()
435 {
436 return toolchains;
437 }
438
439
440 public InvocationRequest setToolchainsFile( File toolchains )
441 {
442 this.toolchains = toolchains;
443 return this;
444 }
445
446
447
448
449
450
451 public File getGlobalToolchainsFile()
452 {
453 return globalToolchains;
454 }
455
456
457 public InvocationRequest setGlobalToolchainsFile( File toolchains )
458 {
459 this.globalToolchains = toolchains;
460 return this;
461 }
462
463
464
465
466
467
468
469 public CheckSumPolicy getGlobalChecksumPolicy()
470 {
471 return globalChecksumPolicy;
472 }
473
474
475
476
477
478
479
480 public InvocationRequest setGlobalChecksumPolicy( CheckSumPolicy globalChecksumPolicy )
481 {
482 this.globalChecksumPolicy = globalChecksumPolicy;
483 return this;
484 }
485
486
487
488
489
490
491 public String getPomFileName()
492 {
493 return pomFilename;
494 }
495
496
497 public InvocationRequest setPomFileName( String pomFilename )
498 {
499 this.pomFilename = pomFilename;
500 return this;
501 }
502
503
504
505
506
507
508 public List<String> getProfiles()
509 {
510 return profiles;
511 }
512
513
514 public InvocationRequest setProfiles( List<String> profiles )
515 {
516 this.profiles = profiles;
517 return this;
518 }
519
520
521
522
523
524
525 public boolean isNonPluginUpdates()
526 {
527 return nonPluginUpdates;
528 }
529
530
531 public InvocationRequest setNonPluginUpdates( boolean nonPluginUpdates )
532 {
533 this.nonPluginUpdates = nonPluginUpdates;
534 return this;
535 }
536
537
538 public InvocationRequest addShellEnvironment( String name, String value )
539 {
540 if ( this.shellEnvironments == null )
541 {
542 this.shellEnvironments = new HashMap<>();
543 }
544 this.shellEnvironments.put( name, value );
545 return this;
546 }
547
548
549
550
551
552
553 public Map<String, String> getShellEnvironments()
554 {
555 return shellEnvironments == null ? Collections.<String, String>emptyMap() : shellEnvironments;
556 }
557
558
559
560
561
562
563 public String getMavenOpts()
564 {
565 return mavenOpts;
566 }
567
568
569 public InvocationRequest setMavenOpts( String mavenOpts )
570 {
571 this.mavenOpts = mavenOpts;
572 return this;
573 }
574
575
576
577
578
579
580
581 public boolean isShowVersion()
582 {
583 return this.showVersion;
584 }
585
586
587 public InvocationRequest setShowVersion( boolean showVersion )
588 {
589 this.showVersion = showVersion;
590 return this;
591 }
592
593
594
595
596
597
598 public String getThreads()
599 {
600 return threads;
601 }
602
603
604 public InvocationRequest setThreads( String threads )
605 {
606 this.threads = threads;
607 return this;
608 }
609
610
611
612
613
614
615 public List<String> getProjects()
616 {
617 return projects;
618 }
619
620
621 public InvocationRequest setProjects( List<String> projects )
622 {
623 this.projects = projects;
624 return this;
625 }
626
627
628
629
630
631
632 public boolean isAlsoMake()
633 {
634 return alsoMake;
635 }
636
637
638 public InvocationRequest setAlsoMake( boolean alsoMake )
639 {
640 this.alsoMake = alsoMake;
641 return this;
642 }
643
644
645
646
647
648
649 public boolean isAlsoMakeDependents()
650 {
651 return alsoMakeDependents;
652 }
653
654
655 public InvocationRequest setAlsoMakeDependents( boolean alsoMakeDependents )
656 {
657 this.alsoMakeDependents = alsoMakeDependents;
658 return this;
659 }
660
661
662
663
664
665
666 public String getResumeFrom()
667 {
668 return resumeFrom;
669 }
670
671
672 public InvocationRequest setResumeFrom( String resumeFrom )
673 {
674 this.resumeFrom = resumeFrom;
675 return this;
676 }
677
678
679 public InvocationRequest setBuilder( String id )
680 {
681 this.builderId = id;
682 return this;
683 }
684
685
686
687
688
689
690 public String getBuilder()
691 {
692 return this.builderId;
693 }
694
695
696
697 @Override
698 public int getTimeoutInSeconds()
699 {
700 return timeoutInSeconds;
701 }
702
703
704 @Override
705 public void setTimeoutInSeconds( int timeoutInSeconds )
706 {
707 this.timeoutInSeconds = timeoutInSeconds;
708 }
709
710
711
712
713
714
715
716 public boolean isQuiet()
717 {
718 return quiet;
719 }
720
721
722 public InvocationRequest setQuiet( boolean quiet )
723 {
724 this.quiet = quiet;
725 return this;
726 }
727 }