I'm using Maven for my project and it works great for running my application. However, when I deploy the application to a JAR file, it flattens the natives directory and thus JOGL cannot load the native libraries because the naming scheme is incorrect.
What do I need to do to make Maven include a natives/ directory? This is what I currently use in my pom.xml: <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>path.to.MainClass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> |
Administrator
|
Hi
Maybe you can call an Ant script within Maven to fix that. Why not using maven-nativedependencies-plugin?
Julien Gouesse | Personal blog | Website
|
I'd rather not have to make an Ant script to fix the Maven build! How would I use maven-nativedependencies-plugin for this?
|
Administrator
|
Please look at the example project here and you can adapt it to use JOGL:
http://code.google.com/p/mavennatives/ I'm not sure it does exactly what you want. Maven is very rigid but based on Ant, using Ant with Maven isn't weird (with antrun-plugin). I have found no way of using a file mapper or disabling the flattening, it hasn't been implemented in Maven: http://jira.codehaus.org/browse/MASSEMBLY-45 Edit.: Have you tried to use dependencySet? http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
Julien Gouesse | Personal blog | Website
|
I never liked the fat-JAR approach (sooo many problems) so I distribute a ZIP-file. But I guess that the same tricks I use can be used to make a fat jar without flattening.
This is one of my assembly.xml : https://code.google.com/p/svansprogram/source/browse/application/svansprogram-assembly/assembly.xml This takes all project dependecies and put in a "lib" directory (the first dependecySet), I set unpack=false because i don't want the JARs unpacked. Then I take the executable JAR and put in the directory above the lib-directory. However, what you could probably do is use several dependecySets, but with unpack=true, that takes the dependecies one-by-one and unpacks them in respective directories with JOGL-compatible names. The assembly plugin should then finally ZIP all of it into one file, I use ZIP but I guess it could use JAR packaging also - haven't tried that. So I guess dependecySets is the solution, that's why there never was a file mapper. BTW, Ant+Ivy is still the best build system for java IMHO |
Free forum by Nabble | Edit this page |