1<?xml version="1.0" encoding="UTF-8"?>
2<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">
3
4
5    <!--
6        The ANTLR Maven artifacts are now released via the Sonotype OSS
7        repository, which means that they are synced to Maven central 
8        within a few minutes of hitting the release repo for Sonotype.
9        To enable this, we inherit from the Sonotype provided parent
10        pom. However, we must also configure our .m2/settings.xml to include
11        the snapshot and staging server and the sonotype password. This 
12        means that only ANTLR developers can released the artifacts, but
13        anyone can build locally.
14      -->
15    <parent>
16        <groupId>org.sonatype.oss</groupId>
17        <artifactId>oss-parent</artifactId>
18        <version>7</version>
19    </parent>    
20    
21    <modelVersion>4.0.0</modelVersion>
22    <groupId>org.antlr</groupId>
23    <artifactId>antlr-master</artifactId>
24    <packaging>pom</packaging>
25    <version>3.4</version>
26    <name>ANTLR Master build control POM 3.4</name>
27    <url>http://maven.apache.org</url>
28
29
30
31  <!--
32    What version of ANTLR are we building? This sets the
33    the version number for all other things that are built
34    as part of an ANTLR release, unless they override or
35    ignore it. We do this via a properites file for this
36    pom.
37    -->
38
39  <!--
40     This is the master pom for building the ANTLR
41     toolset and runtime (Java) at the specific level
42     defined above. Hence we specify here the modules that
43     this pom will build when we build this pom in certain profiles.
44    -->
45
46  <!--
47    Make sure that the build is not platform dependent (I.E show that
48    all the files in the source tree are in UTF-8 format.
49    -->
50    <properties>
51        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
52    </properties>
53
54        <profiles>
55            <profile>
56                <id>standard</id>
57                <activation>
58                    <activeByDefault>true</activeByDefault>
59                </activation>
60                <modules>
61                    <module>runtime/Java</module>
62                    <module>tool</module>
63                    <module>antlr3-maven-plugin</module>
64                    <module>gunit</module>
65                    <module>gunit-maven-plugin</module>
66                    <module>antlr3-maven-archetype</module>
67                </modules>
68            </profile>
69
70            <!--
71                Activate this profile to build ONLY the Uber jar, which is the
72                ANTLR tool and its dependencies (no plugins etc).
73                
74                mvn -Duber -DskipTests package assembly:assembly
75                
76              -->
77            <profile>
78                <id>uber</id>
79                <activation>
80                    <property>
81                        <name>uber</name>
82                        <value>true</value>
83                    </property>
84                </activation>
85                <modules>
86                    <module>runtime/Java</module>
87                    <module>tool</module>
88                </modules>
89                <build>
90                    <plugins>
91                        <plugin>
92
93                        <!--
94
95                            Build an uber-jar for the ANTLR Tool that is packaged with all the other dependencies,
96                            such as the antlr-runtime and stringtemplate etc. This will be useful
97                            for developers, who then do not need to download anything else or
98                            remember that they need stringtemplate.jar in their CLASSPATH and so
99                            on.
100
101                            This does not preclude any of the module generated jars from
102                            being used on their own of course.
103
104                            Here, we also build a master source jar as I was unable to pursuade
105                            this plugin to use multiple configurations and not have the thing
106                            screw up because of multiple modules :-(
107
108                          -->
109
110                            <artifactId>maven-assembly-plugin</artifactId>
111                            <version>2.2.1</version>
112                            <!--
113                                Do not make the child modules build an assembly
114                              -->
115                            <inherited>false</inherited>
116
117                            <configuration>
118                                <descriptors>
119                                    <descriptor>antlrjar.xml</descriptor>
120                                    <descriptor>antlrsources.xml</descriptor>
121                                </descriptors>
122                                    <!--
123
124                                        Specify that we want the resulting jar to be executable
125                                        via java -jar, which we do by modifying the manifest
126                                        of course.
127                                      -->
128                                <archive>
129                                    <manifest>
130                                        <mainClass>org.antlr.Tool</mainClass>
131                                    </manifest>
132                                </archive>
133                            </configuration>
134
135                        </plugin>
136                    </plugins>
137                </build>
138            </profile>
139            
140            <profile>
141                <id>release-sign-artifacts</id>
142                <activation>
143                    <property>
144                        <name>deploy</name>
145                        <value>true</value>
146                    </property>
147                </activation>
148                <modules>
149                    <module>runtime/Java</module>
150                    <module>tool</module>
151                    <module>antlr3-maven-plugin</module>
152                    <module>gunit</module>
153                    <module>gunit-maven-plugin</module>
154                    <module>antlr3-maven-archetype</module>
155                </modules>
156                <build>
157                    <plugins>
158                        
159                        <plugin>
160                            <groupId>org.apache.maven.plugins</groupId>
161                            <artifactId>maven-gpg-plugin</artifactId>
162                            <version>1.3</version>
163                            <executions>
164                                <execution>
165                                    <id>sign-artifacts</id>
166                                    <phase>verify</phase>
167                                    <goals>
168                                       <goal>sign</goal>
169                                    </goals>
170                                </execution>
171                            </executions>
172                        </plugin>
173                        
174                        <plugin>
175                            <groupId>org.apache.maven.plugins</groupId>
176                            <artifactId>maven-javadoc-plugin</artifactId>
177                            <version>2.8</version>
178                            <executions>
179                                <execution>
180                                    <id>attach-javadocs</id>
181                                    <goals>
182                                        <goal>jar</goal>
183                                    </goals>
184                                </execution>
185                            </executions>
186                        </plugin>
187                        
188                        <plugin>
189                            <groupId>org.apache.maven.plugins</groupId>
190                            <artifactId>maven-source-plugin</artifactId>
191                            <version>2.1.2</version>
192                            <executions>
193                                <execution>
194                                    <id>attach-sources</id>
195                                    <goals>
196                                       <goal>jar</goal>
197                                    </goals>
198                                </execution>
199                            </executions>
200                        </plugin>
201                        
202                    </plugins>
203                </build>
204            </profile>
205            
206    </profiles>
207
208  <!--
209
210    Tell Maven which other artifacts we need in order to
211    build, run and test the ANTLR jars.
212    This is the master pom, and so it only contains those
213    dependencies that are common to all the modules below
214    or are just included for test
215    -->
216    <dependencyManagement>
217
218        <dependencies>
219
220            <dependency>
221                <groupId>junit</groupId>
222                <artifactId>junit</artifactId>
223                <version>4.8.2</version>
224                <scope>test</scope>
225            </dependency>
226
227
228        </dependencies>
229
230    </dependencyManagement>
231
232    <build>
233
234        <defaultGoal>install</defaultGoal>
235
236        <!--
237            The following filter definition means that both the master
238            project and the sub projects will read in a file in the same
239            directory as the pom.xml is located and set any properties
240            that are defined there in the standard x=y format. These
241            properties can then be referenced via ${x} in any resource
242            file specified in any pom. So, there is a master antlr.config
243            file in the same location as this pom.xml file and here you can
244            define anything that is relevant to all the modules that we
245            build here. However each module also has an antlr.config file
246            where you can override property values from the master file or
247            define things that are only relevant to that module.
248          -->
249        <filters>
250            <filter>antlr.config</filter>
251        </filters>
252
253        <resources>
254            <resource>
255                <directory>src/main/resources</directory>
256                <filtering>true</filtering>
257            </resource>
258        </resources>
259
260        <plugins>
261
262             <plugin>
263                <groupId>org.codehaus.mojo</groupId>
264                <artifactId>buildnumber-maven-plugin</artifactId>
265                <version>1.0-beta-2</version>
266                <configuration>
267                  <format>{0,date,MMM dd, yyyy} {0,time,kk:mm:ss}</format>
268                  <items>
269                    <item>timestamp</item>
270                  </items>
271                </configuration>
272                <executions>
273                  <execution>
274                    <phase>validate</phase>
275                    <goals>
276                      <goal>create</goal>
277                    </goals>
278                  </execution>
279                </executions>
280             </plugin>
281
282            <plugin>
283                <artifactId>maven-compiler-plugin</artifactId>
284                <version>2.3.2</version>
285                <configuration>
286                    <source>1.6</source>
287                    <target>jsr14</target>
288                    <sourceDirectory>src</sourceDirectory>
289                </configuration>
290            </plugin>
291
292            <plugin>
293                <artifactId>maven-surefire-plugin</artifactId>
294                <version>2.9</version>
295            </plugin>
296
297            <plugin>
298                <groupId>org.codehaus.mojo</groupId>
299                <artifactId>findbugs-maven-plugin</artifactId>
300                <version>2.3.2</version>
301                <configuration>
302                    <findbugsXmlOutput>true</findbugsXmlOutput>
303                    <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
304                    <xmlOutput>true</xmlOutput>
305                </configuration>
306            </plugin>
307            
308        </plugins>
309
310    </build>
311</project>
312