View Javadoc
1   /*
2    * Copyright (C) 2015 Uwe Plonus <uwe.plonus@sw4j.org>
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16   */
17  package org.sw4j.mojo.apisniffer;
18  
19  import java.io.File;
20  import java.io.IOException;
21  import org.apache.maven.plugin.AbstractMojo;
22  import org.apache.maven.plugin.MojoExecutionException;
23  import org.apache.maven.plugin.MojoFailureException;
24  import org.apache.maven.plugins.annotations.Mojo;
25  import org.apache.maven.plugins.annotations.Parameter;
26  
27  /**
28   *
29   * @author Uwe Plonus &lt;u.plonus@gmail.com&gt;
30   */
31  @Mojo(name = "scan")
32  public class ScanApiMojo extends AbstractMojo {
33  
34      /**
35       * The directory where compiled classes are placed.
36       */
37      @Parameter(defaultValue = "${project.build.outputDirectory}", required = true, readonly = true)
38      private File outputDirectory;
39  
40      @Override
41      public void execute() throws MojoExecutionException, MojoFailureException {
42          getLog().debug("Executing scan mojo.");
43          try {
44              getLog().debug(new StringBuilder("Scanning directory ")
45                  .append(outputDirectory.getCanonicalPath()).toString());
46          } catch (IOException ioex) {
47              getLog().error(new StringBuilder("Determining directory to scan not possible."));
48              throw new MojoExecutionException("Determining directory to scan not possible.", ioex);
49          }
50      }
51  
52  }