1 | |
package com.aurea.maven.plugins.sonic.esb.ai; |
2 | |
|
3 | |
import java.io.File; |
4 | |
import java.util.List; |
5 | |
|
6 | |
import org.apache.maven.plugin.MojoExecutionException; |
7 | |
import org.apache.maven.plugin.MojoFailureException; |
8 | |
|
9 | |
import com.aurea.maven.plugins.sonic.esb.AbstractESBMojo; |
10 | |
import com.aurea.maven.plugins.util.VelocityRunner; |
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | 0 | public class ServiceGroupGeneratorMojo extends AbstractESBMojo { |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
private List<String> templateFiles; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
private String propFileName; |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | 0 | private String aiOutputDirName = "ai"; |
44 | |
|
45 | |
@Override |
46 | |
protected void doExecute() throws MojoExecutionException, MojoFailureException { |
47 | |
|
48 | 0 | getLog().info("Executing Velocity ...."); |
49 | |
|
50 | 0 | VelocityRunner runner = VelocityRunner.getInstance(project); |
51 | 0 | runner.setOutputDirectory(aiOutputDirName); |
52 | 0 | runner.addProperties("user", propFileName); |
53 | 0 | runner.addProperty("project", project); |
54 | |
|
55 | 0 | for(String tplFile: templateFiles) { |
56 | 0 | getLog().debug("Generating Template: " + tplFile); |
57 | |
try { |
58 | 0 | runner.run(tplFile, new File(tplFile).getName()); |
59 | 0 | } catch (Exception e) { |
60 | 0 | throw new MojoExecutionException("Template generation failed.", e); |
61 | 0 | } |
62 | 0 | } |
63 | 0 | } |
64 | |
} |