I have a Project called Parent. Its type is POM. There is a library (ojdbc6.jar
) that is not available in public repository so I am accessing it via <SystemPath>
as you can see in below pom.xml
:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.Parent</groupId>
<artifactId>Parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>childModule</module>
</modules>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>6</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc6.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
Now the child project names are Child-Module1 and Child-Module2 use this (ojdbc6.jar
) library It's POM is mentioned below:
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>testApp</artifactId>
<version>1.14.5.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>APP1</name>
<description>Application</description>
<parent>
<groupId>com.Parent</groupId>
<artifactId>Parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
</project>
When I build using Maven it gives me error:
Description Resource Path Location Type
The container 'Maven Dependencies' references non existing library
'C:\Users\ABCCOMPUTER_NAME\.m2\repository\com\oracle\ojdbc\6\ojdbc-6.jar'
testApp Build path Problem.
Why does it looks in local repository? It happen only when parent project contains a library (jar
) that contains system path. It does not happen when access system path library (jar
) in same project, like parent referring ojdbc6.jar
, it is fine there.
I resolved the issue by updating systemPath in parent pom.xml as shown below :
<systemPath>${main.basedir}/lib/ojdbc6.jar</systemPath>
and then adding the main.basedir property in parent pom.xml and repository
<properties>
<main.basedir>${project.basedir}</main.basedir>
</properties>
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${main.basedir}/lib</url>
</repository>
</repositories>
then adding below properties and repositories element in child module(The "/.." is added as the child module folder reside in parent folder so go up one directory then rest absolute path to parent lib folder shall be generated as expected):
<properties>
<main.basedir>${project.basedir}/..</main.basedir>
</properties>
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${main.basedir}/lib</url>
</repository>
</repositories>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With