|
8 | 8 | - Compile src/java, src/java-unsafe, and generated sources |
9 | 9 | - Include resources from src/resources |
10 | 10 | - Include native libraries by extracting them from the published 1.8.0 jar |
11 | | - - Wrap the jar with bnd 1.50.0 using lz4-java.bnd to match OSGi metadata |
12 | 11 | - Preserve Automatic-Module-Name: org.lz4.java |
13 | | -
|
14 | | - Note: We deliberately do the bnd wrapping after the regular jar build and overwrite the main artifact, |
15 | | - to keep the final jar identical in structure to the Ant "bundle" target output. |
16 | 12 | --> |
17 | 13 | <project xmlns="http://maven.apache.org/POM/4.0.0" |
18 | 14 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
72 | 68 | <native.cc>gcc</native.cc> |
73 | 69 | <native.cflags></native.cflags> |
74 | 70 | <native.ldflags></native.ldflags> |
| 71 | + |
| 72 | + <!-- plugin versions --> |
| 73 | + <bnd.maven.plugin.version>7.1.0</bnd.maven.plugin.version> |
| 74 | + <packages.version>${project.version}</packages.version> |
| 75 | + <ivy.version>${project.version}</ivy.version> |
75 | 76 | </properties> |
76 | 77 |
|
77 | 78 | <dependencies> |
|
214 | 215 | <version>3.4.1</version> |
215 | 216 | <configuration> |
216 | 217 | <archive> |
| 218 | + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
217 | 219 | <manifestEntries> |
218 | 220 | <Automatic-Module-Name>org.lz4.java</Automatic-Module-Name> |
219 | 221 | </manifestEntries> |
220 | 222 | </archive> |
221 | 223 | </configuration> |
222 | 224 | </plugin> |
223 | 225 |
|
| 226 | + <plugin> |
| 227 | + <groupId>biz.aQute.bnd</groupId> |
| 228 | + <artifactId>bnd-maven-plugin</artifactId> |
| 229 | + <version>${bnd.maven.plugin.version}</version> |
| 230 | + <executions> |
| 231 | + <execution> |
| 232 | + <goals> |
| 233 | + <goal>bnd-process</goal> |
| 234 | + </goals> |
| 235 | + </execution> |
| 236 | + </executions> |
| 237 | + <configuration> |
| 238 | + <bndfile>lz4-java.bnd</bndfile> |
| 239 | + </configuration> |
| 240 | + </plugin> |
| 241 | + |
224 | 242 | <plugin> |
225 | 243 | <groupId>org.apache.maven.plugins</groupId> |
226 | 244 | <artifactId>maven-antrun-plugin</artifactId> |
|
229 | 247 | <dependency> |
230 | 248 | <groupId>biz.aQute.bnd</groupId> |
231 | 249 | <artifactId>biz.aQute.bnd.ant</artifactId> |
232 | | - <version>7.1.0</version> |
| 250 | + <version>${bnd.maven.plugin.version}</version> |
233 | 251 | </dependency> |
234 | 252 | <dependency> |
235 | 253 | <groupId>org.mvel</groupId> |
|
257 | 275 | <goal>run</goal> |
258 | 276 | </goals> |
259 | 277 | </execution> |
260 | | - <!-- Use bndwrap for OSGi stuff that I don't understand. Could probably use maven-bundle-plugin here... --> |
261 | | - <execution> |
262 | | - <id>bnd-wrap-jar</id> |
263 | | - <phase>package</phase> |
264 | | - <configuration> |
265 | | - <target> |
266 | | - <!-- Set properties used by lz4-java.bnd --> |
267 | | - <property name="packages.version" value="${project.version}"/> |
268 | | - <property name="ivy.revision" value="${project.version}"/> |
269 | | - <property name="-noextraheaders" value="true"/> |
270 | | - <property name="-reproducible" value="true"/> |
271 | | - |
272 | | - <!-- Define bnd ant task from plugin dependency --> |
273 | | - <taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="maven.plugin.classpath"/> |
274 | | - |
275 | | - <!-- Wrap the plain jar into the final OSGi bundle --> |
276 | | - <bndwrap definitions="${project.basedir}" |
277 | | - output="${project.build.directory}/${project.build.finalName}-wrapped.jar" |
278 | | - trace="true"> |
279 | | - <fileset dir="${project.build.directory}" includes="${project.build.finalName}.jar"/> |
280 | | - </bndwrap> |
281 | | - |
282 | | - <!-- Replace the original jar with the wrapped one (as in Ant: delete plain jar) --> |
283 | | - <delete file="${project.build.directory}/${project.build.finalName}.jar"/> |
284 | | - <move file="${project.build.directory}/${project.build.finalName}-wrapped.jar" |
285 | | - tofile="${project.build.directory}/${project.build.finalName}.jar"/> |
286 | | - </target> |
287 | | - </configuration> |
288 | | - <goals> |
289 | | - <goal>run</goal> |
290 | | - </goals> |
291 | | - </execution> |
292 | 278 | </executions> |
293 | 279 | </plugin> |
294 | 280 | <plugin> |
|
0 commit comments