Skip to content

Commit 62ec6b3

Browse files
committed
cleanup pom and plugins
Signed-off-by: Terence Parr <[email protected]>
1 parent fc59296 commit 62ec6b3

File tree

6 files changed

+180
-154
lines changed

6 files changed

+180
-154
lines changed

antlr3-maven-archetype/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@
3535
</extensions>
3636

3737
<plugins>
38-
<!--
3938
<plugin>
4039
<artifactId>maven-archetype-plugin</artifactId>
4140
<version>2.2</version>
4241
<extensions>true</extensions>
4342
</plugin>
44-
-->
45-
4643
</plugins>
4744

4845
</build>

antlr3-maven-plugin/pom.xml

Lines changed: 69 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,53 +34,27 @@
3434

3535

3636
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
37-
38-
<!-- Maven model we are inheriting from
39-
-->
4037
<modelVersion>4.0.0</modelVersion>
41-
42-
<!--
43-
44-
Now that the ANTLR project has adopted Maven with a vengence,
45-
all ANTLR tools will be grouped under org.antlr and will be
46-
controlled by a project member.
47-
-->
48-
<groupId>org.antlr</groupId>
49-
50-
51-
<!--
52-
53-
This is the ANTLR plugin for ANTLR version 3.1.3 and above. It might
54-
have been best to change the name of the plugin as the 3.1.2 plugins
55-
behave a little differently, however for the sake of one transitional
56-
phase to a much better plugin, it was decided that the name should
57-
remain the same.
58-
-->
59-
<artifactId>antlr3-maven-plugin</artifactId>
60-
<packaging>maven-plugin</packaging>
61-
6238
<parent>
6339
<groupId>org.antlr</groupId>
6440
<artifactId>antlr-master</artifactId>
6541
<version>3.5.3-SNAPSHOT</version>
6642
</parent>
67-
43+
<artifactId>antlr3-maven-plugin</artifactId>
44+
<packaging>maven-plugin</packaging>
6845
<name>ANTLR 3 Maven plugin</name>
69-
<prerequisites>
70-
<maven>2.0</maven>
71-
</prerequisites>
46+
47+
<properties>
48+
<mavenVersion>3.8.4</mavenVersion>
49+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
50+
</properties>
7251

7352
<!--
7453
Where does our actual project live on the interwebs.
7554
-->
7655
<url>http://antlr.org</url>
7756

78-
<properties>
79-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
80-
</properties>
81-
8257
<description>
83-
8458
This is the brand new, re-written from scratch plugin for ANTLR v3.
8559

8660
Previous valiant efforts all suffered from being unable to modify the ANTLR Tool
@@ -106,11 +80,9 @@ to death. Hence even this pom has more comments than funcitonal elements,
10680
in case I get run over by a bus or fall off a cliff while skiing.
10781

10882
Jim Idle - March 2009
109-
11083
</description>
11184

11285
<developers>
113-
11486
<developer>
11587
<name>Jim Idle</name>
11688
<url>http://www.temporal-wave.com</url>
@@ -159,25 +131,78 @@ Jim Idle - March 2009
159131
<!--
160132
The things we need to build the target language recognizer
161133
-->
134+
<!-- The things we need to build the target language recognizer -->
162135
<dependency>
163136
<groupId>org.apache.maven</groupId>
164137
<artifactId>maven-plugin-api</artifactId>
165-
<version>2.0</version>
166-
<scope>compile</scope>
138+
<version>3.8.4</version>
139+
<scope>provided</scope>
140+
</dependency>
141+
<dependency>
142+
<groupId>org.codehaus.plexus</groupId>
143+
<artifactId>plexus-compiler-api</artifactId>
144+
<version>2.9.0</version>
145+
</dependency>
146+
<dependency>
147+
<groupId>org.sonatype.plexus</groupId>
148+
<artifactId>plexus-build-api</artifactId>
149+
<version>0.0.7</version>
150+
</dependency>
151+
<!-- The version of ANTLR tool that this version of the plugin controls.
152+
We have decided that this should be in lockstep with ANTLR itself, other
153+
than -1 -2 -3 etc patch releases. -->
154+
<dependency>
155+
<groupId>org.antlr</groupId>
156+
<artifactId>antlr</artifactId>
157+
<version>3.5.3-SNAPSHOT</version>
158+
</dependency>
159+
<!-- Testing requirements... -->
160+
<dependency>
161+
<groupId>junit</groupId>
162+
<artifactId>junit</artifactId>
163+
<version>4.13.2</version>
164+
<scope>test</scope>
165+
</dependency>
166+
<dependency>
167+
<groupId>org.apache.maven.plugin-tools</groupId>
168+
<artifactId>maven-plugin-annotations</artifactId>
169+
<version>3.6.2</version>
170+
<scope>provided</scope>
171+
</dependency>
172+
<dependency>
173+
<groupId>io.takari.maven.plugins</groupId>
174+
<artifactId>takari-plugin-testing</artifactId>
175+
<version>3.0.0</version>
176+
<scope>test</scope>
167177
</dependency>
168-
169178
<dependency>
170179
<groupId>org.apache.maven</groupId>
171-
<artifactId>maven-project</artifactId>
172-
<version>2.0</version>
180+
<artifactId>maven-core</artifactId>
181+
<version>3.8.4</version>
182+
<scope>provided</scope>
183+
</dependency>
184+
<dependency>
185+
<groupId>org.apache.maven</groupId>
186+
<artifactId>maven-compat</artifactId>
187+
<version>3.8.4</version>
188+
<scope>test</scope>
173189
</dependency>
174-
175190
<dependency>
176191
<groupId>org.codehaus.plexus</groupId>
177-
<artifactId>plexus-compiler-api</artifactId>
178-
<version>2.0</version>
192+
<artifactId>plexus-utils</artifactId>
193+
<version>3.4.1</version>
194+
<scope>provided</scope>
195+
</dependency>
196+
<dependency>
197+
<groupId>org.slf4j</groupId>
198+
<artifactId>slf4j-api</artifactId>
199+
<version>1.7.32</version>
200+
</dependency>
201+
<dependency>
202+
<groupId>org.slf4j</groupId>
203+
<artifactId>slf4j-simple</artifactId>
204+
<version>1.7.32</version>
179205
</dependency>
180-
181206
<!--
182207
The version of ANTLR tool that this version of the plugin controls.
183208
We have decided that this should be in lockstep with ANTLR itself, other

antlr3-maven-plugin/src/main/java/org/antlr/mojo/antlr3/Antlr3Mojo.java

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,25 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5151
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
5252
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
5353
import 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>**&#47;*.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

Comments
 (0)