Skip to content

Commit 5f0f5e8

Browse files
committed
Updated to generate a fully valid jar with native libraries
Also on Mac we would get image not found and had to add a step to the build to patch the library dependency information See: https://stackoverflow.com/a/53155508/1331732 and especially https://matthew-brett.github.io/docosx/mac_runtime_link.html
1 parent ac352ac commit 5f0f5e8

File tree

1 file changed

+126
-69
lines changed

1 file changed

+126
-69
lines changed

mdbxjni-osx64/pom.xml

+126-69
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,138 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Copyright (C) 2018, Castor Technologies Inc.
3+
Copyright (C) 2018, Castor Technologies Inc.
44
5-
http://www.castortech.com/
5+
http://www.castortech.com/
66
7-
Licensed under the Apache License, Version 2.0 (the "License");
8-
you may not use this file except in compliance with the License.
9-
You may obtain a copy of the License at
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
1010
11-
http://www.apache.org/licenses/LICENSE-2.0
11+
http://www.apache.org/licenses/LICENSE-2.0
1212
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
1818
-->
1919
<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">
20-
<modelVersion>4.0.0</modelVersion>
21-
<parent>
22-
<groupId>com.castortech.mdbxjni</groupId>
23-
<artifactId>mdbxjni-project</artifactId>
24-
<version>99-master-SNAPSHOT</version>
25-
</parent>
20+
<modelVersion>4.0.0</modelVersion>
21+
<parent>
22+
<groupId>com.castortech.mdbxjni</groupId>
23+
<artifactId>mdbxjni-project</artifactId>
24+
<version>99-master-SNAPSHOT</version>
25+
</parent>
2626

27-
<groupId>com.castortech.mdbxjni</groupId>
28-
<artifactId>mdbxjni-osx64</artifactId>
29-
<version>99-master-SNAPSHOT</version>
30-
31-
<name>${project.artifactId}</name>
32-
<description>The mdbxjni OS X 64 bit native libraries</description>
27+
<groupId>com.castortech.mdbxjni</groupId>
28+
<artifactId>mdbxjni-osx64</artifactId>
29+
<version>99-master-SNAPSHOT</version>
3330

34-
<dependencies>
35-
<dependency>
36-
<groupId>com.castortech.mdbxjni</groupId>
37-
<artifactId>mdbxjni</artifactId>
38-
<version>99-master-SNAPSHOT</version>
39-
</dependency>
40-
</dependencies>
31+
<name>${project.artifactId}</name>
32+
<description>The mdbxjni OS X 64 bit native libraries</description>
4133

42-
<build>
43-
<testSourceDirectory>${basedir}/../mdbxjni/src/test/java</testSourceDirectory>
44-
<plugins>
45-
<plugin>
46-
<groupId>org.apache.maven.plugins</groupId>
47-
<artifactId>maven-jar-plugin</artifactId>
48-
<version>${mvn-jar-version}</version>
49-
<configuration>
50-
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory>
51-
</configuration>
52-
</plugin>
53-
<plugin>
54-
<groupId>org.fusesource.hawtjni</groupId>
55-
<artifactId>hawtjni-maven-plugin</artifactId>
56-
<version>${hawtjni-version}</version>
57-
<executions>
58-
<execution>
59-
<goals>
60-
<goal>build</goal>
61-
</goals>
62-
</execution>
63-
</executions>
64-
<configuration>
65-
<name>mdbxjni</name>
66-
<classified>false</classified>
67-
<nativeSrcDependency>
68-
<groupId>com.castortech.mdbxjni</groupId>
69-
<artifactId>mdbxjni</artifactId>
70-
<version>${project.version}</version>
71-
<classifier>native-src</classifier>
72-
<type>zip</type>
73-
</nativeSrcDependency>
74-
<configureArgs>
75-
<arg>--with-mdbx=${env.MDBX_HOME}</arg>
76-
</configureArgs>
77-
</configuration>
78-
</plugin>
79-
</plugins>
80-
</build>
34+
<dependencies>
35+
<dependency>
36+
<groupId>com.castortech.mdbxjni</groupId>
37+
<artifactId>mdbxjni</artifactId>
38+
<version>99-master-SNAPSHOT</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.fluttercode.datafactory</groupId>
42+
<artifactId>datafactory</artifactId>
43+
<version>0.8</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>com.google.guava</groupId>
48+
<artifactId>guava</artifactId>
49+
<version>${guava-version}</version>
50+
</dependency>
51+
</dependencies>
52+
53+
<build>
54+
<testSourceDirectory>${basedir}/../mdbxjni/src/test/java</testSourceDirectory>
55+
<plugins>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-jar-plugin</artifactId>
59+
<version>${mvn-jar-version}</version>
60+
<configuration>
61+
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory>
62+
</configuration>
63+
</plugin>
64+
<plugin>
65+
<groupId>org.fusesource.hawtjni</groupId>
66+
<artifactId>hawtjni-maven-plugin</artifactId>
67+
<version>${hawtjni-version}</version>
68+
<executions>
69+
<execution>
70+
<goals>
71+
<goal>build</goal>
72+
</goals>
73+
</execution>
74+
</executions>
75+
<configuration>
76+
<name>mdbxjni</name>
77+
<classified>false</classified>
78+
<nativeSrcDependency>
79+
<groupId>com.castortech.mdbxjni</groupId>
80+
<artifactId>mdbxjni</artifactId>
81+
<version>${project.version}</version>
82+
<classifier>native-src</classifier>
83+
<type>zip</type>
84+
</nativeSrcDependency>
85+
<configureArgs>
86+
<arg>--with-mdbx=${env.MDBX_HOME}</arg>
87+
</configureArgs>
88+
</configuration>
89+
</plugin>
90+
<plugin>
91+
<groupId>org.codehaus.mojo</groupId>
92+
<artifactId>exec-maven-plugin</artifactId>
93+
<version>3.0.0</version>
94+
<executions>
95+
<execution>
96+
<id>fixlibdep</id>
97+
<phase>prepare-package</phase>
98+
<goals>
99+
<goal>exec</goal>
100+
</goals>
101+
<configuration>
102+
<workingDirectory>${basedir}/target/generated-sources/hawtjni/lib/META-INF/native/osx64</workingDirectory>
103+
<executable>install_name_tool</executable>
104+
<commandlineArgs>-change libmdbx.dylib @loader_path/libmdbx.dylib libmdbxjni.dylib</commandlineArgs>
105+
</configuration>
106+
</execution>
107+
</executions>
108+
</plugin>
109+
<plugin>
110+
<groupId>org.apache.maven.plugins</groupId>
111+
<artifactId>maven-resources-plugin</artifactId>
112+
<version>3.1.0</version>
113+
<executions>
114+
<execution>
115+
<id>copy-dll</id>
116+
<phase>prepare-package</phase>
117+
<goals>
118+
<goal>copy-resources</goal>
119+
</goals>
120+
<configuration>
121+
<outputDirectory>${basedir}/target/generated-sources/hawtjni/lib/META-INF/native/osx64</outputDirectory>
122+
<overwrite>true</overwrite>
123+
<resources>
124+
<resource>
125+
<directory>${basedir}/../../libmdbx/</directory>
126+
<filtering>false</filtering>
127+
<includes>
128+
<include>libmdbx.dylib</include>
129+
</includes>
130+
</resource>
131+
</resources>
132+
</configuration>
133+
</execution>
134+
</executions>
135+
</plugin>
136+
</plugins>
137+
</build>
81138
</project>

0 commit comments

Comments
 (0)