java - Unable to access parent project library(jar) in child module - Maven -
i have project called parent. type pom. there library (ojdbc6.jar
) not available in public repository accessing via <systempath>
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 child project names child-module1 , child-module2 use (ojdbc6.jar
) library it's pom 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 build using maven gives me error:
description resource path location type 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 looks in local repository? happen when parent project contains library (jar
) contains system path. not happen when access system path library (jar
) in same project, parent referring ojdbc6.jar
, fine there.
i resolved issue updating systempath in parent pom.xml shown below :
<systempath>${main.basedir}/lib/ojdbc6.jar</systempath>
and adding main.basedir property in parent pom.xml , 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 , repositories element in child module(the "/.." added child module folder reside in parent folder go 1 directory rest absolute path parent lib folder shall generated 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>
Comments
Post a Comment