Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8313703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:34:46+00:00 2026-06-08T20:34:46+00:00

My multimodule project contains 10 modules 3 of which require a 3rdparty jni. The

  • 0

My multimodule project contains 10 modules 3 of which require a 3rdparty jni. The three must unpack the jni artifact and add its location to LD_LIBRARY_PATH for test execution.

What’s the elegant maven way to handle this situation?

  • Add dependency, unpack via maven-dependency-plugin execution surefire property to the three modules (violates dont-repeat-yourself principle and won’t scale).
  • Use a profile in central pom for these steps and activate it with needsFooJni property (profiles aren’t per module and should be used for platform or other build-wide needs)
  • Use executions controlled by properties in top level pom (seems a little fragile).

So, What’s the elegant maven way to handle this kind of situation so my native dependencies are used in the test phase.

Thanks

Peter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:34:48+00:00Added an answer on June 8, 2026 at 8:34 pm

    I opted for this solution:

    • Add top level properties for the default JNI location. In the example below, I’ve also added a “special” case for a JNI that required a specific structure to locate additional resources.
      `${project.basedir}/target/extracted
      ${project.basedir}/target/cache/special
      ${extractedJniCache}${path.separator}${specialExceptionLibrayCache}’

    • Add properties to control extraction

      <skipSpecialJNIExtraction>true<skipSpecialJNIExtraction>
      <skipFooBarJNIExtraction>true<skipFooBarJNIExtraction>

    • Define dependency extraction executions controlled by skip properties (default is to skip and individual modules can override

    • In my surefire configuration define path and ld library path
      <environmentVariables>
      <PATH>${env.PATH}${path.separator}${ldLibraryAddon}</PATH>
      <LD_LIBRARY_PATH>${ldLibraryAddon}</LD_LIBRARY_PATH>

      `

    By default, all tests add directories for the JNIs to PATH/LD_LIBRARY_PATh for test execution. These directories will only exist if the module overrides the skip properties.

    It’s not as elegant as I’d like, but it is centralized to the master pom keeping complexity in one place and keeping the module poms small.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multimodule maven setup for my project, made of 5 modules, which
I have a multi-module maven project made up of three sub-modules: web , service
The site generated for a multi-module Maven project contains a Dependency Convergence section, which
I have a Maven project multimodule project. Some of the modules create custom packaging
JRebel 5.0.0 (201206080930) Have multimodule maven project, which is assembling into war and deploying
I have multimodule project. Can I make it somehow work that when calling compile
I have a maven multimodule project. What the best practices for creating groupId? Can
Im having a problem with a multimodule project in maven/jenkins. For example my structure
I have some multi-module project. Some modules are packaged as wars and some as
Hi I need to assembly jars from multimodule project in master directory. Let us

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.