View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.cli;
20  
21  import java.io.File;
22  import java.nio.file.Path;
23  import java.util.Properties;
24  
25  import org.apache.commons.cli.CommandLine;
26  import org.apache.maven.execution.DefaultMavenExecutionRequest;
27  import org.apache.maven.execution.MavenExecutionRequest;
28  import org.codehaus.plexus.classworlds.ClassWorld;
29  
30  /**
31   * CliRequest
32   */
33  public class CliRequest {
34      String[] args;
35  
36      CommandLine commandLine;
37  
38      ClassWorld classWorld;
39  
40      String workingDirectory;
41  
42      File multiModuleProjectDirectory;
43  
44      Path rootDirectory;
45  
46      Path topDirectory;
47  
48      boolean debug;
49  
50      boolean quiet;
51  
52      boolean showErrors = true;
53  
54      Properties userProperties = new Properties();
55  
56      Properties systemProperties = new Properties();
57  
58      MavenExecutionRequest request;
59  
60      CliRequest(String[] args, ClassWorld classWorld) {
61          this.args = args;
62          this.classWorld = classWorld;
63          this.request = new DefaultMavenExecutionRequest();
64      }
65  
66      public String[] getArgs() {
67          return args;
68      }
69  
70      public CommandLine getCommandLine() {
71          return commandLine;
72      }
73  
74      public ClassWorld getClassWorld() {
75          return classWorld;
76      }
77  
78      public String getWorkingDirectory() {
79          return workingDirectory;
80      }
81  
82      public File getMultiModuleProjectDirectory() {
83          return multiModuleProjectDirectory;
84      }
85  
86      public boolean isDebug() {
87          return debug;
88      }
89  
90      public boolean isQuiet() {
91          return quiet;
92      }
93  
94      public boolean isShowErrors() {
95          return showErrors;
96      }
97  
98      public Properties getUserProperties() {
99          return userProperties;
100     }
101 
102     public Properties getSystemProperties() {
103         return systemProperties;
104     }
105 
106     public MavenExecutionRequest getRequest() {
107         return request;
108     }
109 
110     public void setUserProperties(Properties properties) {
111         this.userProperties.putAll(properties);
112     }
113 }