NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #162 (closed defect: fixed)

Opened 2010-08-23T11:51:35-05:00

Last modified 2011-04-25T11:40:28-05:00

Maven: research use of Maven with native libraries

Reported by: curtis Owned by: curtis
Priority: major Milestone: biweekly-2011: Apr-11 to Apr-22
Component: Build System Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

Sometimes, a Java component will have one or more corresponding native libraries associated with it. In our case, we would like to migrate Rick's decon project to the Java repository under Maven, but it needs some native library integration to work properly.

See  this article for some details.

Change History

comment:1 Changed 2010-08-31T11:51:14-05:00 by curtis

  • Component changed from other to build

comment:2 Changed 2010-09-17T17:47:52-05:00 by curtis

  • Milestone changed from biweekly-2010: Sep-07 to Sep-17 to biweekly-2010: Sep-20 to Oct-01

comment:3 Changed 2010-09-30T16:58:03-05:00 by aivar

Using Maven2 to build projects which use JNI code
Richard van der Hoff

The solution he wound up with is to put the native code in a jar file then he wrote an open-source custom loader that decompresses from the jar file into a temporary directory and does the loadLibrary.

 http://docs.codehaus.org/display/MAVENUSER/Projects+With+JNI

Maven code repository:

 http://opensource.mxtelecom.com/maven/repo/com/wapmx/native/mx-native-loader/1.2/

Here is the LICENSE file:

Copyright (c) 2008 MX Telecom

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

comment:4 Changed 2010-10-01T16:51:47-05:00 by curtis

  • Milestone changed from biweekly-2010: Sep-20 to Oct-01 to biweekly-2010: Oct-04 to Oct-15

comment:5 Changed 2010-10-03T21:36:23-05:00 by curtis

It looks like the  FreeHEP Maven Native Archive Plugin has gotten very good since van der Hoff's article (he even says as much). It looks like we may not even need CMake at all to use it. Hopefully it is good enough to meet our use cases.

comment:6 Changed 2010-10-03T21:50:37-05:00 by curtis

Turns out that freehep-nar-plugin has been replaced by  maven-nar-plugin.

comment:7 Changed 2010-10-18T10:29:28-05:00 by curtis

  • Milestone changed from biweekly-2010: Oct-04 to Oct-15 to biweekly-2010: Nov-01 to Nov-12

comment:8 Changed 2010-11-29T10:52:13-06:00 by curtis

  • Milestone changed from biweekly-2010: Nov-15 to Nov-24 to biweekly-2010: Nov-29 to Dec-10

comment:9 Changed 2010-12-09T13:40:56-06:00 by curtis

  • Priority changed from minor to major

comment:10 Changed 2011-02-15T09:39:16-06:00 by curtis

  • Milestone changed from biweekly-2011: Feb-14 to Feb-25 to biweekly-2011: Mar-14 to Mar-25

comment:11 Changed 2011-03-13T21:37:48-05:00 by curtis

  • Milestone changed from biweekly-2011: Mar-14 to Mar-25 to biweekly-2011: Mar-28 to Apr-08

comment:12 Changed 2011-03-13T22:36:15-05:00 by curtis

Aivar now has a source:trunk/extra/native-library-util project for handling native libraries. I need to better understand how to use Maven to build native code, whether the maven-nar-plugin will be useful for deployment (Aivar says no), and how he is currently using the maven-native-plugin.

comment:13 Changed 2011-04-25T11:22:39-05:00 by curtis

  • Status changed from new to closed
  • Resolution set to fixed

At this point Aivar has done a lot more research into this issue, and generally has the maven-nar-plugin working with SLIM-curve. I am closing this ticket for the time being, and will reopen if needed.

comment:14 Changed 2011-04-25T11:40:28-05:00 by curtis

See ticket #281 for further details on Aivar's work.