Reputation: 1396
The situation is largely similar as in this SO question except for the resource I'm trying to point to is outside the project folder.
The background is that I have a git repo that contains a few projects. One of the projects requires a jar from another project for running so the intended dependency should be smth like this:
<dependency>
<groupId>another-proj-jar</groupId>
<artifactId>another-proj-jar</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>../another-proj/build/another-proj.jar</systemPath>
</dependency>
another-proj
is not a Maven project (and converting it to a Maven proj is an issue of itself, let's skip it here) so I create that jar manually through Eclipse import.
However, I am not sure whether it is possible to indicate a relative path beyond the project directory because all examples point to //${basedir}/my-repo
where ${basedir}
is essentially the current project folder. I need to make it one level up the current project's folder.
Could you tell me whether it's possible and how or what could be a workaround?
Upvotes: 2
Views: 2751
Reputation: 17435
Really this should just be a normal dependency. In the project you are dependent on (another-proj in your example) run a mvn clean install
. This will copy the .jar file to your ~/.m2/repository
directory. Then in the project that requires the library have a dependency like:
<dependency>
<groupId>another-proj-jar</groupId>
<artifactId>another-proj-jar</artifactId>
<version>1.0-SNAPSHOT</version> <!-- or whatever it is set to -->
</dependency>
The huge advantage with this is that if the jar you're pulling in requires anything else then that'll get pulled in too.
Upvotes: 2