1   package org.apache.maven.plugins.jmod;
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  import java.io.File;
23  import java.io.IOException;
24  import java.util.List;
25  
26  import org.apache.maven.plugin.MojoExecutionException;
27  import org.apache.maven.plugin.MojoFailureException;
28  import org.apache.maven.plugins.annotations.LifecyclePhase;
29  import org.apache.maven.plugins.annotations.Mojo;
30  import org.apache.maven.plugins.annotations.Parameter;
31  import org.apache.maven.plugins.annotations.ResolutionScope;
32  import org.codehaus.plexus.util.cli.Commandline;
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  @Mojo( name = "hash", requiresDependencyResolution = ResolutionScope.COMPILE, defaultPhase = LifecyclePhase.PACKAGE )
43  public class JModHashMojo
44      extends AbstractJModMojo
45  {
46  
47      
48  
49  
50      @Parameter
51      private List<String> classPath;
52  
53      
54  
55  
56      @Parameter
57      private List<String> cmds;
58  
59      
60  
61  
62      @Parameter
63      private File config;
64  
65      @Parameter
66      private boolean dryRun;
67  
68      @Parameter
69      private List<String> excludes;
70  
71      @Parameter
72      private String mainClass;
73  
74      @Parameter
75      private List<File> libs;
76  
77      @Parameter
78      private String moduleVersion;
79  
80      
81  
82  
83  
84      @Parameter( required = true )
85      private File modulePath;
86  
87      public void execute()
88          throws MojoExecutionException, MojoFailureException
89      {
90  
91          String jModExecutable;
92          try
93          {
94              jModExecutable = getJModExecutable();
95          }
96          catch ( IOException e )
97          {
98              throw new MojoFailureException( "Unable to find jmod command: " + e.getMessage(), e );
99          }
100 
101         Commandline cmd = createJModHashCommandLine();
102         cmd.setExecutable( jModExecutable );
103 
104         
105 
106     }
107 
108     private Commandline createJModHashCommandLine()
109     {
110         Commandline cmd = new Commandline();
111 
112         cmd.createArg().setValue( "hash" );
113 
114         if ( dryRun )
115         {
116             cmd.createArg().setValue( "--dry-run" );
117         }
118 
119         return cmd;
120     }
121 
122 }