View Javadoc
1   /*
2    * The akquinet maven-latex-plugin project
3    *
4    * Copyright (c) 2011 by akquinet tech@spree GmbH
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package eu.simuline.m2latex.mojo;
20  
21  import eu.simuline.m2latex.core.BuildFailureException;
22  
23  import org.apache.maven.plugins.annotations.Mojo;
24  
25  import org.apache.maven.plugin.MojoFailureException;
26  
27  // documentation occurs in latex:help
28  /**
29   * Transforms all graphic files into formats 
30   * which can be included into LaTeX files 
31   * for the goal <code>grp</code> which is not tied to a lifecycle phase. 
32   */
33  @Mojo(name = "grp")
34  public class GraphicsMojo extends AbstractLatexMojo {
35  
36      /**
37       * Invoked by maven executing the plugin. 
38       * <p>
39       * Logging: 
40       * <ul>
41       * <li> WFU01: Cannot read directory 
42       * <li> WFU03: cannot close file 
43       * <li> EFU07, EFU08, EFU09: if filtering a file fails. 
44       * <li> WPP02: tex file may be latex main file 
45       * <li> WPP03: Skipped processing of files with suffixes ... 
46       * <li> EEX01, EEX02, EEX03, WEX04, WEX05: 
47       * if running graphic processors failed. 
48       * </ul>
49       *
50       * @throws MojoFailureException
51       *    <ul>
52       *    <li> 
53       *    TSS02 if the tex source processing directory does either not exist 
54       *    or is not a directory. 
55       *    <li> 
56       *    TEX01 invoking FIXME
57       *    </ul>
58       */
59      public void execute() throws MojoFailureException  {
60  	initialize();
61  	try {
62  	    // may throw BuildFailureException TSS02, TEX01 
63  	    // may log warnings WFU01, WFU03, WPP02, WPP03, 
64  	    // EEX01, EEX02, EEX03, WEX04, WEX05: EFU07, EFU08, EFU09
65  	    this.latexProcessor.processGraphics();
66  	} catch (BuildFailureException e) {
67  	    throw new MojoFailureException(e.getMessage(), e.getCause());
68  	}
69      }
70  }