6

Is it possible to manage native libraries (.so) under maven?

We use some jars with dependences on external native libs, so I'm looking for some way to mavenize them.

Thanks.

SyBer
  • 5,407
  • 13
  • 55
  • 64
  • This prior answer might be helpful: http://stackoverflow.com/questions/1001774/managing-dll-dependencies-with-maven/1020101#1020101 – sal Mar 10 '10 at 15:43

1 Answers1

7

I think that the "common" approach is to bundle the native libraries in platform specific JARs using classifiers (e.g. mylib-1.2.3-solaris.jar) on which you could depend like any other JAR with classifier:

<dependency>
  <groupId>my.group</groupId>
  <artifactId>mylib</artifactId>
  <version>1.2.3</version>
  <classifier>solaris</classifier>
</dependency>

And then, unpack them with the maven-dependency-plugin and the unpack-dependencies mojo.

Also have a look at this previous answer, the Wrapping a Native Library with Maven post and the section 5.5.3. Platform Classifiers of the Maven: the complete reference,

Corey
  • 664
  • 9
  • 18
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124