1

I have following structure in project

| prj
  | a1_module
     |src
     |pom
  | a2_module
     |src
     |pom     
  | lib 
     xyz.jar
  |pom(parent)

Now i register xyz.jar in sub module(a1_module) pom like this:

 <dependency>
    <groupId>com.asd.prj</groupId>
    <artifactId>pubsub</artifactId>
    <version>1.0.0.</version>
    <scope>system</scope>
    <systemPath>${project.parent.basedir}/lib/pubsub_2.11-1.0.0-SNAPSHOTjar</systemPath>
</dependency>

I expect ${project.parent.basedir}/lib/pubsub_2.11-1.0.0-SNAPSHOTjar should give me prj/lib/pubsub_2.11-1.0.0-SNAPSHOTjar but it gives me path like this prj/a1_module/lib/pubsub_2.11-1.0.0-SNAPSHOTjar.

Beacuse of this situtaion i get error as there is no jar kept in sub-module but its kept outside in "lib" directory of main project.

This question says that project.parent.basedir should give path of parent of that module path but in my case its giving me path of submodule rather parent module path.

Any suggestion that what i am doing wrong or what is other way to register my local jar in submodules.

Javier C.
  • 7,859
  • 5
  • 41
  • 53
Ankit Agrahari
  • 349
  • 9
  • 22
  • 1
    Remove a system scope dependency and don't use such lib directory constructs...They really bad things in Maven. Better start using a repository manager and deploy this jar into the repository manager...and afterwards use the jar as usual dependency...(I assume the pubsub-1.0.0-SNAPSHOT.jar has been created by another Maven build?) – khmarbaise Oct 19 '17 at 08:35
  • You are right @khmarbaise. I am going to follow repository manager way. This is not the good way to do. – Ankit Agrahari Oct 20 '17 at 00:02

1 Answers1

0

You can use this:

<systemPath>${basedir}/../lib/pubsub_2.11-1.0.0-SNAPSHOTjar</systemPath>
halfer
  • 19,824
  • 17
  • 99
  • 186
question_maven_com
  • 2,457
  • 16
  • 21