Skip to content

Commit d703b79

Browse files
author
Jim Idle
committedJul 19, 2011
Slight mods for building UBER jar executable
[git-p4: depot-paths = "//depot/code/antlr/release-3.4/": change = 8889]
1 parent adc7e8e commit d703b79

File tree

3 files changed

+176
-306
lines changed

3 files changed

+176
-306
lines changed
 

‎antlrjar.xml

+19-43
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
<!--
44
This file defines what goes in to ANTLR Uber jar, which includes
55
all of the classes we need to run an executable jar in standalone
6-
mode, other than junit, which has a non Free BSD license and so
7-
we are reluctanct to include it in the jar.
6+
mode.
87
-->
98
<assembly>
109

@@ -23,7 +22,7 @@
2322

2423
<!--
2524
Make all jars unpack at the same level and don't include
26-
any extranous directories.
25+
any extraneous directories.
2726
-->
2827
<includeBaseDirectory>false</includeBaseDirectory>
2928

@@ -43,55 +42,34 @@
4342

4443
</includes>
4544
<!--
46-
Of the binaries, such as the depencies that the
45+
Of the binaries, such as the dependencies that the
4746
above modules need, which do we want and which do we not.
4847
Currently we want all the dependencies in the Tool jar.
4948
-->
5049
<binaries>
5150

52-
<dependencySets>
53-
<dependencySet>
54-
<!--
55-
Exclude the antlr-master pom from the jar - we don't need it
56-
and it causes silly things to happen.
57-
-->
58-
<useProjectArtifact>false</useProjectArtifact>
51+
<dependencySets>
52+
<dependencySet>
53+
<!--
54+
Exclude the antlr-master pom from the jar - we don't need it
55+
and it causes silly things to happen.
56+
-->
57+
<useProjectArtifact>false</useProjectArtifact>
5958

60-
<!--
61-
Unpack the binary dependencies so we have a nice
62-
uber jar that can run with java -jar and need not have
63-
CLASSPATH configured and so on.
64-
-->
65-
<unpack>true</unpack>
66-
</dependencySet>
67-
</dependencySets>
59+
<!--
60+
Unpack the binary dependencies so we have a nice
61+
uber jar that can run with java -jar and need not have
62+
CLASSPATH configured and so on.
63+
-->
64+
<unpack>true</unpack>
65+
</dependencySet>
66+
</dependencySets>
6867

6968

7069
</binaries>
7170

7271
</moduleSet>
73-
74-
<moduleSet>
75-
76-
<includes>
77-
78-
<include>org.antlr:gunit</include>
79-
80-
</includes>
81-
82-
<!--
83-
We do not want any of the dependencies that gunit has as they
84-
are inlcuded with the tool. In particular we want to exclude
85-
the junit dependency.
86-
-->
87-
<binaries>
88-
89-
<includeDependencies>false</includeDependencies>
90-
91-
</binaries>
92-
93-
</moduleSet>
94-
72+
9573
</moduleSets>
9674

9775
<!--
@@ -107,6 +85,4 @@
10785
</fileSet>
10886
</fileSets>
10987

110-
111-
11288
</assembly>

‎antlrsources.xml

+4-150
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--
44
55
This is the assembly descriptor for building a full source code
6-
distribution of ANTLR and all its related components. This assmebly
6+
distribution of ANTLR and all its related components. This assembly
77
only includes the Java oriented source code, hence only the Java runtime
88
is included in the resulting jar.
99
@@ -34,7 +34,7 @@
3434
</formats>
3535

3636
<!--
37-
The resulting archives will hve a base directory named after the master
37+
The resulting archives will have a base directory named after the master
3838
artifact, rather than just extract into the current directory.
3939
-->
4040
<includeBaseDirectory>true</includeBaseDirectory>
@@ -43,57 +43,10 @@
4343
including in the archive. In the main this is because we did not store
4444
the modules in perforce using directory names that match the module
4545
names. This was for historic reasons as we already moved everything
46-
about massively, jsut to move to Maven inthe first place.
46+
about massively, just to move to Maven in the first place.
4747
-->
4848
<moduleSets>
4949

50-
<!-- Describe the gUnit source code.
51-
-->
52-
<moduleSet>
53-
54-
<!-- The Maven artifact name tells the assembly artifact a bunch
55-
of information to start with, such as its location in the current
56-
tree and so on.
57-
-->
58-
<includes>
59-
<include>org.antlr:gunit</include>
60-
</includes>
61-
62-
<!-- What sources do we wish to include from this module?
63-
-->
64-
<sources>
65-
66-
<fileSets>
67-
68-
<!-- We have one file set, being the src sub-directory, which in
69-
the output archive, we also want to be called src/
70-
-->
71-
<fileSet>
72-
<directory>src</directory>
73-
<outputDirectory>src</outputDirectory>
74-
</fileSet>
75-
76-
77-
<!-- In the base gUnit directory, we need to include a number
78-
of files that either document the module or control the
79-
build. These are not underneath the src directory of course
80-
so they need to be named here (which nicely documents what
81-
is included.
82-
-->
83-
<fileSet>
84-
<includes>
85-
<include>pom.xml</include>
86-
<include>CHANGES.txt</include>
87-
<include>LICENSE.txt</include>
88-
<include>README.txt</include>
89-
<include>antlr.config</include>
90-
</includes>
91-
</fileSet>
92-
</fileSets>
93-
</sources>
94-
95-
</moduleSet>
96-
9750
<!-- Describe the gUnit source code.
9851
-->
9952
<moduleSet>
@@ -164,7 +117,7 @@
164117
-->
165118
<outputDirectoryMapping>tool</outputDirectoryMapping>
166119

167-
120+
168121
<fileSets>
169122

170123
<!-- We have one file set, being the src sub-directory, which in
@@ -193,105 +146,6 @@
193146

194147
</fileSets>
195148

196-
197-
</sources>
198-
199-
</moduleSet>
200-
201-
<!-- Describe the ANTLR maven plugin source code.
202-
203-
Strictly speaking, this is not a sub module of the tool because it
204-
relies on the tool, runtime, and gunit modules. However, it is natural
205-
part of the Java source set and so I found a way to build it as a sub-module
206-
and include it in the source set.
207-
-->
208-
<moduleSet>
209-
<includes>
210-
<include>org.antlr:antlr3-maven-plugin</include>
211-
</includes>
212-
213-
<!-- What sources do we wish to include from this module?
214-
-->
215-
<sources>
216-
217-
218-
<fileSets>
219-
220-
<!-- We have one file set, being the src sub-directory, which in
221-
the output archive, we also want to be called src/
222-
-->
223-
<fileSet>
224-
<directory>src</directory>
225-
<outputDirectory>src</outputDirectory>
226-
</fileSet>
227-
228-
<!-- In the base plugin directory, we need to include a number
229-
of files that either document the module or control the
230-
build. These are not underneath the src directory of course
231-
so they need to be named here (which nicely documents what
232-
is included.
233-
-->
234-
<fileSet>
235-
<includes>
236-
<include>pom.xml</include>
237-
</includes>
238-
</fileSet>
239-
</fileSets>
240-
241-
242-
</sources>
243-
244-
</moduleSet>
245-
246-
<!-- Describe the gUnit maven plugin source code.
247-
248-
Strictly speaking, this is not a sub module of the tool because it
249-
relies on the tool, runtime, and gunit modules. However, it is natural
250-
part of the Java source set and so I found a way to build it as a sub-module
251-
and include it in the source set.
252-
-->
253-
<moduleSet>
254-
<includes>
255-
<include>org.antlr:maven-gunit-plugin</include>
256-
</includes>
257-
258-
<!-- What sources do we wish to include from this module?
259-
-->
260-
<sources>
261-
262-
<!-- Because the tool source code is not in a directory
263-
called antlr, nor directly underneath the master
264-
directory, we need to map the output directory so that
265-
instead of starting with the name of the artifact, it
266-
is in the place where the build expects it.
267-
-->
268-
<outputDirectoryMapping>gunit-maven-plugin</outputDirectoryMapping>
269-
270-
<!-- We have one file set, being the src sub-directory, which in
271-
the output archive, we also want to be called src/
272-
-->
273-
<fileSets>
274-
275-
<fileSet>
276-
<directory>src</directory>
277-
<outputDirectory>src</outputDirectory>
278-
</fileSet>
279-
280-
<!-- In the base plugin directory, we need to include a number
281-
of files that either document the module or control the
282-
build. These are not underneath the src directory of course
283-
so they need to be named here (which nicely documents what
284-
is included.
285-
-->
286-
<fileSet>
287-
288-
<includes>
289-
<include>pom.xml</include>
290-
</includes>
291-
</fileSet>
292-
293-
</fileSets>
294-
295149
</sources>
296150

297151
</moduleSet>

‎pom.xml

+153-113
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,9 @@
4040
This is the master pom for building the ANTLR
4141
toolset and runtime (Java) at the specific level
4242
defined above. Hence we specify here the modules that
43-
this pom will build when we build this pom
43+
this pom will build when we build this pom in certain profiles.
4444
-->
4545

46-
<modules>
47-
48-
<module>runtime/Java</module>
49-
<module>tool</module>
50-
<module>antlr3-maven-plugin</module>
51-
<module>gunit</module>
52-
<module>gunit-maven-plugin</module>
53-
<module>antlr3-maven-archetype</module>
54-
</modules>
55-
5646
<!--
5747
Make sure that the build is not platform dependent (I.E show that
5848
all the files in the source tree are in UTF-8 format.
@@ -61,34 +51,158 @@
6151
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6252
</properties>
6353

64-
<profiles>
65-
<profile>
66-
<id>release-sign-artifacts</id>
67-
<activation>
68-
<property>
69-
<name>deploy</name>
70-
<value>true</value>
71-
</property>
72-
</activation>
73-
<build>
74-
<plugins>
75-
<plugin>
76-
<groupId>org.apache.maven.plugins</groupId>
77-
<artifactId>maven-gpg-plugin</artifactId>
78-
<version>1.3</version>
79-
<executions>
80-
<execution>
81-
<id>sign-artifacts</id>
82-
<phase>verify</phase>
83-
<goals>
84-
<goal>sign</goal>
85-
</goals>
86-
</execution>
87-
</executions>
88-
</plugin>
89-
</plugins>
90-
</build>
91-
</profile>
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+
92206
</profiles>
93207

94208
<!--
@@ -190,80 +304,6 @@
190304
<xmlOutput>true</xmlOutput>
191305
</configuration>
192306
</plugin>
193-
194-
<plugin>
195-
196-
<!--
197-
198-
Build an uber-jar for the ANTLR Tool that is packaged with all the other dependencies,
199-
such as the antlr-runtime and stringtemplate etc. This will be useful
200-
for developers, who then do not need to download anything else or
201-
remember that they need stringtemplate.jar in their CLASSPATH and so
202-
on.
203-
204-
This does not preclude any of the module generated jars from
205-
being used on their own of course.
206-
207-
Here, we also build a master source jar as I was unable to pursuade
208-
this plugin to use multiple configurations and not have the thing
209-
screw up because of multiple modules :-(
210-
211-
-->
212-
213-
<artifactId>maven-assembly-plugin</artifactId>
214-
<version>2.2.1</version>
215-
<!--
216-
Do not make the child modules build an assembly
217-
-->
218-
<inherited>false</inherited>
219-
220-
<configuration>
221-
<descriptors>
222-
<descriptor>antlrjar.xml</descriptor>
223-
<descriptor>antlrsources.xml</descriptor>
224-
</descriptors>
225-
<!--
226-
227-
Specify that we want the resulting jar to be executable
228-
via java -jar, which we do by modifying the manifest
229-
of course.
230-
-->
231-
<archive>
232-
<manifest>
233-
<mainClass>org.antlr.Tool</mainClass>
234-
</manifest>
235-
</archive>
236-
</configuration>
237-
238-
</plugin>
239-
240-
<plugin>
241-
<groupId>org.apache.maven.plugins</groupId>
242-
<artifactId>maven-source-plugin</artifactId>
243-
<version>2.1.2</version>
244-
<executions>
245-
<execution>
246-
<id>attach-sources</id>
247-
<goals>
248-
<goal>jar</goal>
249-
</goals>
250-
</execution>
251-
</executions>
252-
</plugin>
253-
254-
<plugin>
255-
<groupId>org.apache.maven.plugins</groupId>
256-
<artifactId>maven-javadoc-plugin</artifactId>
257-
<version>2.8</version>
258-
<executions>
259-
<execution>
260-
<id>attach-javadocs</id>
261-
<goals>
262-
<goal>jar</goal>
263-
</goals>
264-
</execution>
265-
</executions>
266-
</plugin>
267307

268308
</plugins>
269309

0 commit comments

Comments
 (0)
Please sign in to comment.