@@ -51,20 +51,25 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5151import org .codehaus .plexus .compiler .util .scan .SourceInclusionScanner ;
5252import org .codehaus .plexus .compiler .util .scan .mapping .SourceMapping ;
5353import org .codehaus .plexus .compiler .util .scan .mapping .SuffixMapping ;
54+ import org .apache .maven .plugins .annotations .Component ;
55+ import org .apache .maven .plugins .annotations .LifecyclePhase ;
56+ import org .apache .maven .plugins .annotations .Mojo ;
57+ import org .apache .maven .plugins .annotations .Parameter ;
58+ import org .apache .maven .plugins .annotations .ResolutionScope ;
59+ import org .apache .maven .project .MavenProject ;
5460
5561/**
5662 * Parses ANTLR grammar files {@code *.g} and transforms them into Java source
5763 * files.
5864 *
59- * @goal antlr
60- * @phase generate-sources
61- * @requiresDependencyResolution compile
62- * @requiresProject true
63- *
6465 * @author <a href="mailto:[email protected] ">Jim Idle</a> 6566 */
66- public class Antlr3Mojo
67- extends AbstractMojo {
67+ @ Mojo (
68+ name = "antlr" ,
69+ defaultPhase = LifecyclePhase .GENERATE_SOURCES ,
70+ requiresDependencyResolution = ResolutionScope .COMPILE ,
71+ requiresProject = true , threadSafe = true )
72+ public class Antlr3Mojo extends AbstractMojo {
6873
6974 // First, let's deal with the options that the ANTLR tool itself
7075 // can be configured by.
@@ -73,88 +78,77 @@ public class Antlr3Mojo
7378 * If set to true, then after the tool has processed an input grammar file
7479 * it will report various statistics about the parser, such as information
7580 * on cyclic DFAs, which rules may use backtracking, and so on.
76- *
77- * @parameter default-value="false"
7881 */
82+ @ Parameter (property = "report" , defaultValue = "false" )
7983 protected boolean report ;
8084 /**
8185 * If set to true, then the ANTLR tool will print a version of the input
8286 * grammar(s) which are stripped of any embedded actions.
83- *
84- * @parameter default-value="false"
8587 */
88+ @ Parameter (property = "printGrammar" , defaultValue = "false" )
8689 protected boolean printGrammar ;
8790 /**
8891 * If set to true, then the code generated by the ANTLR code generator will
8992 * be set to debug mode. This means that when run, the code will 'hang' and
9093 * wait for a debug connection on a TCP port (49100 by default).
91- *
92- * @parameter default-value="false"
9394 */
95+ @ Parameter (property = "debug" , defaultValue = "false" )
9496 protected boolean debug ;
9597 /**
9698 * If set to true, then the generated parser will compute and report profile
9799 * information at runtime.
98- *
99- * @parameter default-value="false"
100100 */
101+ @ Parameter (property = "profile" , defaultValue = "false" )
101102 protected boolean profile ;
102103 /**
103104 * If set to true, then the ANTLR tool will generate a description of the
104105 * NFA for each rule in <a href="http://www.graphviz.org">Dot format</a>
105- *
106- * @parameter default-value="false"
107106 */
107+ @ Parameter (property = "nfa" , defaultValue = "false" )
108108 protected boolean nfa ;
109109 /**
110110 * If set to true, then the ANTLR tool will generate a description of the
111111 * DFA for each decision in the grammar in
112112 * <a href="http://www.graphviz.org">Dot format</a>.
113- *
114- * @parameter default-value="false"
115113 */
114+ @ Parameter (property = "dfa" , defaultValue = "false" )
116115 protected boolean dfa ;
117116 /**
118117 * If set to true, the generated parser code will log rule entry and exit
119118 * points to stdout ({@link System#out} for the Java target) as an aid to
120119 * debugging.
121- *
122- * @parameter default-value="false"
123120 */
121+ @ Parameter (property = "trace" , defaultValue = "false" )
124122 protected boolean trace ;
125123 /**
126124 * If this parameter is set, it indicates that any warning or error messages
127125 * returned by ANLTR, should be formatted in the specified way. Currently,
128126 * ANTLR supports the built-in formats {@code antlr}, {@code gnu} and
129127 * {@code vs2005}.
130- *
131- * @parameter default-value="antlr"
132128 */
129+ @ Parameter (property = "messageFormat" , defaultValue = "antlr" )
133130 protected String messageFormat ;
134131 /**
135132 * If set to true, then ANTLR will report verbose messages during the code
136133 * generation process. This includes the names of files, the version of
137134 * ANTLR, and more.
138- *
139- * @parameter default-value="true"
140135 */
136+ @ Parameter (property = "verbose" , defaultValue = "true" )
141137 protected boolean verbose ;
142138
143139 /**
144140 * The maximum number of alternatives allowed in an inline switch statement.
145141 * Beyond this, ANTLR will not generate a switch statement for the DFA.
146- *
147- * @parameter default-value="300"
148142 */
143+ @ Parameter (property = "maxSwitchCaseLabels" , defaultValue = "300" )
149144 private int maxSwitchCaseLabels ;
150145
151146 /**
152147 * The minimum number of alternatives for ANTLR to generate a switch
153148 * statement. For decisions with fewer alternatives, an if/else if/else
154149 * statement will be used instead.
155- *
156- * @parameter default-value="3"
157150 */
151+ @ Parameter (property = "minSwitchAlts" , defaultValue = "3" )
158152 private int minSwitchAlts ;
159153
160154 /* --------------------------------------------------------------------
@@ -171,49 +165,40 @@ public class Antlr3Mojo
171165 * A set of Ant-like inclusion patterns used to select files from the source
172166 * directory for processing. By default, the pattern <code>**/*.g</code>
173167 * is used to select grammar files.</p>
174- *
175- * @parameter
176168 */
169+ @ Parameter
177170 protected Set <String > includes = new HashSet <String >();
178171 /**
179172 * A set of Ant-like exclusion patterns used to prevent certain files from
180173 * being processed. By default, this set is empty such that no files are
181174 * excluded.
182- *
183- * @parameter
184175 */
176+ @ Parameter
185177 protected Set <String > excludes = new HashSet <String >();
186178 /**
187179 * The current Maven project.
188- *
189- * @parameter expression="${project}"
190- * @required
191- * @readonly
192180 */
181+ @ Parameter (property = "project" , required = true , readonly = true )
193182 protected MavenProject project ;
194183 /**
195184 * The directory where the ANTLR grammar files ({@code *.g}) are located.
196- *
197- * @parameter default-value="${basedir}/src/main/antlr3"
198185 */
186+ @ Parameter (defaultValue = "${basedir}/src/main/antlr3" )
199187 private File sourceDirectory ;
200188 /**
201189 * The directory where the parser files generated by ANTLR will be stored.
202190 * The directory will be registered as a compile source root of the project
203191 * such that the generated files will participate in later build phases like
204192 * compiling and packaging.
205- *
206- * @parameter default-value="${project.build.directory}/generated-sources/antlr3"
207- * @required
208193 */
194+ @ Parameter (defaultValue = "${project.build.directory}/generated-sources/antlr3" , required = true )
209195 private File outputDirectory ;
210196 /**
211197 * Location for imported token files, e.g. {@code *.tokens} and imported
212198 * grammars. Note that ANTLR will not try to process grammars that it finds
213199 * to be imported into other grammars (in the same processing session).
214- *
215- * @parameter default-value="${basedir}/src/main/antlr3/imports"
216200 */
201+ @ Parameter (defaultValue = "${basedir}/src/main/antlr3/imports" )
217202 private File libDirectory ;
218203
219204 public File getSourceDirectory () {
0 commit comments