1

I'm trying to build a plugin that contains some native libraries. The project has the standard maven layout but is currently not configured as a maven project for m2e. (I will do this after eclipse can build my plugin)

I put my native libs under src/main/resources and configured eclipse the following way:

build.properties:

source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
       src/main/resources/libdb_java-5.0.so,\
       src/main/resources/libdb-5.0.so,\
       .

BuildPath: My BuildPath

But eclipse doesn't copy my native libs from src/main/resources to target/classes. Does anyone know what I'm missing?

Best regards

Marc-Christian Schulze
  • 3,154
  • 3
  • 35
  • 45

1 Answers1

1

I think you have to manually add the src/main/resources folder as a class folder to your project under the Libraries tab to have the native libs available at runtime.

For the resulting plugin you should check the exported plugin but i think they should be contained there.

Torsten
  • 6,184
  • 1
  • 34
  • 31
  • Hi. Yes you're right. Adding src/main/resources as a "class folder" works. You could also add the directory as a "source folder". Thanks. Now I got another problem. Eclipse seems to set the library path to the project directory instead to the specified output directory. Do you know how to change this? – Marc-Christian Schulze Jul 13 '11 at 17:46
  • I am not sure I fully understand what you mean, I guess you are referring to what you find under Runtime Information on the Build tab. The library found there (.) is defined in the last build.properties entry of bin.includes shown above. – Torsten Jul 13 '11 at 19:12
  • I mean that eclipse can't find my native libraries copied under target/classes. If I copy them in the project directory then they can be loaded. I would like to change the library path to target/classes so eclipse can load my libraries. – Marc-Christian Schulze Jul 14 '11 at 07:40
  • Ok, I tried setting the native location like described here: http://stackoverflow.com/questions/957700/how-to-set-the-java-library-path-from-eclipse But eclipse doesn't change my library path. Does it matter that the plugin containing the native libs is actual a fragment bundle? – Marc-Christian Schulze Jul 14 '11 at 08:25
  • That's strange. The error comes from the Bundle-NativeCode: libdb_java-5.0.so; osname="linux"; processor="x86", libdb-5.0.so; osname="linux"; processor="x86" directive in my manifest. When I remove the line then it works. o.O – Marc-Christian Schulze Jul 14 '11 at 08:47