View Javadoc

1   /*
2    * Copyright 2007 scala-tools.org
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing,
11   * software distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions
14   * and limitations under the License.
15   */
16  package org.scala_tools.maven;
17  
18  
19  /**
20   * Display the Scala Compiler help
21   *
22   * @goal help
23   */
24  public class ScalaHelpMojo extends ScalaMojoSupport {
25      /**
26       * @parameter expression="${maven.scala.help.versionOnly}" default-value="false"
27       */
28      private boolean versionOnly;
29  
30      @Override
31      public void doExecute() throws Exception {
32          JavaCommand jcmd = null;
33          if (!versionOnly) {
34              jcmd = getScalaCommand();
35              jcmd.addArgs("-help");
36              jcmd.addArgs("-X");
37              jcmd.addArgs("-Y");
38              jcmd.run(displayCmd);
39          }
40          jcmd = getScalaCommand();
41          jcmd.addArgs("-version");
42          jcmd.run(displayCmd);
43      }
44  }