Skip to content

Commit 807d96e

Browse files
committed
Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes netty#2003 properly - Instead of using 'bundle' packaging, use 'jar' packaging. This is more robust because some strict build tools fail to retrieve the artifacts from a Maven repository unless their packaging is not 'jar'. - All artifacts now contain META-INF/io.netty.version.properties, which provides the detailed information about the build and repository. - Removed OSGi testsuite temporarily because it gives false errors during split package test and examination. - Add io.netty.util.Version for easy retrieval of version information
1 parent 10e3651 commit 807d96e

41 files changed

Lines changed: 519 additions & 1504 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@
1111
/reports
1212
*/reports
1313
.DS_Store
14-
/common/src/main/java/io/netty/util/Version.java
15-
1614

all/pom.xml

Lines changed: 119 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
<properties>
3232
<quickbuild>true</quickbuild>
33+
<generatedSourceDir>${project.build.directory}/src</generatedSourceDir>
34+
<dependencyVersionDir>${project.build.directory}/versions</dependencyVersionDir>
3335
</properties>
3436

3537
<profiles>
@@ -188,6 +190,17 @@
188190
<plugin>
189191
<artifactId>maven-dependency-plugin</artifactId>
190192
<executions>
193+
<!-- Populate the properties whose key is groupId:artifactId:type
194+
and whose value is the path to the artifact -->
195+
<execution>
196+
<id>locate-dependencies</id>
197+
<phase>initialize</phase>
198+
<goals>
199+
<goal>properties</goal>
200+
</goals>
201+
</execution>
202+
203+
<!-- Unpack all source files -->
191204
<execution>
192205
<id>unpack-sources</id>
193206
<phase>prepare-package</phase>
@@ -198,9 +211,11 @@
198211
<classifier>sources</classifier>
199212
<includes>io/netty/**</includes>
200213
<includeGroupIds>${project.groupId}</includeGroupIds>
201-
<outputDirectory>${project.build.directory}/src</outputDirectory>
214+
<outputDirectory>${generatedSourceDir}</outputDirectory>
202215
</configuration>
203216
</execution>
217+
218+
<!-- Unpack all class files -->
204219
<execution>
205220
<id>unpack-jars</id>
206221
<phase>prepare-package</phase>
@@ -215,6 +230,64 @@
215230
</execution>
216231
</executions>
217232
</plugin>
233+
234+
<plugin>
235+
<artifactId>maven-antrun-plugin</artifactId>
236+
<executions>
237+
<!-- Instead of generating a new version property file, merge others' version property files into one. -->
238+
<execution>
239+
<id>write-version-properties</id>
240+
<phase>none</phase>
241+
</execution>
242+
<execution>
243+
<id>merge-version-properties</id>
244+
<phase>prepare-package</phase>
245+
<goals>
246+
<goal>run</goal>
247+
</goals>
248+
<configuration>
249+
<target>
250+
<taskdef resource="net/sf/antcontrib/antlib.xml" />
251+
<propertyselector
252+
property="versions"
253+
match="^(${project.groupId}:(?!netty-example)[^:]+:jar)$" select="\1"/>
254+
<for list="${versions}" param="x">
255+
<sequential>
256+
<unzip src="${@{x}}" dest="${dependencyVersionsDir}">
257+
<patternset>
258+
<include name="META-INF/${project.groupId}.versions.properties"/>
259+
</patternset>
260+
</unzip>
261+
<concat destfile="${project.build.outputDirectory}/META-INF/${project.groupId}.versions.properties"
262+
append="true">
263+
<path path="${dependencyVersionsDir}/META-INF/${project.groupId}.versions.properties"/>
264+
</concat>
265+
</sequential>
266+
</for>
267+
<delete dir="${dependencyVersionsDir}" quiet="true"/>
268+
</target>
269+
</configuration>
270+
</execution>
271+
272+
<!-- Clean everything once finished so that IDE doesn't find the unpacked files. -->
273+
<execution>
274+
<id>clean-source-directory</id>
275+
<phase>package</phase>
276+
<goals>
277+
<goal>run</goal>
278+
</goals>
279+
<configuration>
280+
<target>
281+
<delete dir="${generatedSourceDir}" quiet="true" />
282+
<delete dir="${dependencyVersionDir}" quiet="true" />
283+
<delete dir="${project.build.outputDirectory}" quiet="true" />
284+
</target>
285+
</configuration>
286+
</execution>
287+
</executions>
288+
</plugin>
289+
290+
<!-- Include the directory where the source files were unpacked -->
218291
<plugin>
219292
<groupId>org.codehaus.mojo</groupId>
220293
<artifactId>build-helper-maven-plugin</artifactId>
@@ -227,13 +300,50 @@
227300
</goals>
228301
<configuration>
229302
<sources>
230-
<source>target/src</source>
303+
<source>${generatedSourceDir}</source>
231304
</sources>
232305
</configuration>
233306
</execution>
234307
</executions>
235308
</plugin>
236309

310+
<!-- Disable OSGi bundle manifest generation -->
311+
<plugin>
312+
<groupId>org.apache.felix</groupId>
313+
<artifactId>maven-bundle-plugin</artifactId>
314+
<executions>
315+
<execution>
316+
<id>generate-manifest</id>
317+
<phase>none</phase>
318+
</execution>
319+
</executions>
320+
</plugin>
321+
<!-- Override the default JAR configuration -->
322+
<plugin>
323+
<artifactId>maven-jar-plugin</artifactId>
324+
<executions>
325+
<execution>
326+
<id>default-jar</id>
327+
<phase>none</phase>
328+
</execution>
329+
<execution>
330+
<id>all-in-one-jar</id>
331+
<phase>package</phase>
332+
<goals>
333+
<goal>jar</goal>
334+
</goals>
335+
<configuration>
336+
<archive>
337+
<manifest>
338+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
339+
</manifest>
340+
<index>true</index>
341+
</archive>
342+
</configuration>
343+
</execution>
344+
</executions>
345+
</plugin>
346+
237347
<!-- Disable animal sniffer -->
238348
<plugin>
239349
<groupId>org.codehaus.mojo</groupId>
@@ -245,6 +355,7 @@
245355
</execution>
246356
</executions>
247357
</plugin>
358+
248359
<!-- Disable checkstyle -->
249360
<plugin>
250361
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -255,6 +366,7 @@
255366
</execution>
256367
</executions>
257368
</plugin>
369+
258370
<!-- Disable all plugin executions configured by jar packaging -->
259371
<plugin>
260372
<artifactId>maven-resources-plugin</artifactId>
@@ -291,6 +403,8 @@
291403
</execution>
292404
</executions>
293405
</plugin>
406+
407+
<!-- Generate Xref -->
294408
<plugin>
295409
<artifactId>maven-jxr-plugin</artifactId>
296410
<executions>
@@ -318,6 +432,8 @@
318432
</dependency>
319433
</dependencies>
320434
</plugin>
435+
436+
<!-- Generate Javadoc -->
321437
<plugin>
322438
<artifactId>maven-javadoc-plugin</artifactId>
323439
<executions>
@@ -333,7 +449,7 @@
333449
<excludePackageNames>*.internal,*.example</excludePackageNames>
334450
<docfilessubdirs>true</docfilessubdirs>
335451
<outputDirectory>${project.build.directory}/api</outputDirectory>
336-
<overview>${basedir}/src/javadoc/overview.html</overview>
452+
<overview>${project.basedir}/src/javadoc/overview.html</overview>
337453
<doctitle>Netty API Reference (${project.version})</doctitle>
338454
<windowtitle>Netty API Reference (${project.version})</windowtitle>
339455
<detectJavaApiLink>false</detectJavaApiLink>
@@ -354,24 +470,6 @@
354470
<locale>en_US</locale>
355471
</configuration>
356472
</plugin>
357-
<plugin>
358-
<artifactId>maven-antrun-plugin</artifactId>
359-
<executions>
360-
<execution>
361-
<id>clean-source-directory</id>
362-
<phase>package</phase>
363-
<goals>
364-
<goal>run</goal>
365-
</goals>
366-
</execution>
367-
</executions>
368-
<configuration>
369-
<target>
370-
<delete dir="${project.build.directory}/src" quiet="true" />
371-
<delete dir="${project.build.directory}/classes" quiet="true" />
372-
</target>
373-
</configuration>
374-
</plugin>
375473
</plugins>
376474
</build>
377475
</project>

buffer/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</parent>
2525

2626
<artifactId>netty-buffer</artifactId>
27-
<packaging>bundle</packaging>
27+
<packaging>jar</packaging>
2828

2929
<name>Netty/Buffer</name>
3030

@@ -35,5 +35,4 @@
3535
<version>${project.version}</version>
3636
</dependency>
3737
</dependencies>
38-
3938
</project>

codec-http/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</parent>
2525

2626
<artifactId>netty-codec-http</artifactId>
27-
<packaging>bundle</packaging>
27+
<packaging>jar</packaging>
2828

2929
<name>Netty/Codec/HTTP</name>
3030

@@ -45,7 +45,5 @@
4545
<optional>true</optional>
4646
</dependency>
4747
</dependencies>
48-
49-
5048
</project>
5149

codec-memcache/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</parent>
2525

2626
<artifactId>netty-codec-memcache</artifactId>
27-
<packaging>bundle</packaging>
27+
<packaging>jar</packaging>
2828

2929
<name>Netty/Codec/Memcache</name>
3030

@@ -40,6 +40,5 @@
4040
<version>${project.version}</version>
4141
</dependency>
4242
</dependencies>
43-
4443
</project>
4544

codec-socks/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</parent>
2525

2626
<artifactId>netty-codec-socks</artifactId>
27-
<packaging>bundle</packaging>
27+
<packaging>jar</packaging>
2828

2929
<name>Netty/Codec/Socks</name>
3030

@@ -41,3 +41,4 @@
4141
</dependency>
4242
</dependencies>
4343
</project>
44+

codec/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</parent>
2525

2626
<artifactId>netty-codec</artifactId>
27-
<packaging>bundle</packaging>
27+
<packaging>jar</packaging>
2828

2929
<name>Netty/Codec</name>
3030

@@ -62,6 +62,5 @@
6262
<scope>test</scope>
6363
</dependency>
6464
</dependencies>
65-
6665
</project>
6766

0 commit comments

Comments
 (0)