Reputation: 7404
Is it possible to have a dependency
on a project that is only on my local machine and not in any repository?
If so, how do I specify it in my POM
, would I use the following format below?
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>
Upvotes: 3
Views: 3920
Reputation: 11941
Install that dependency to your local maven repository using mvn install
. Then your local projects can use it as a dependency. Of course that will only work on that one machine.
If you use Eclipse/NetBeans/IntelliJ and have the dependency as well as the project using that dependency opened, you don't need to install it as those IDEs resolve this without involving the local maven repo.
If your dependency is not a maven project, you simply have to reference the jar file. Or you assign artifactId and groupId and install the jar file to your repo.
Both ways are shown here.
Upvotes: 3
Reputation: 21
install the dependency using mvn install
like take a example of oracle ojdbc6 or ojdbc14 jar we cannot find this jar in central or remode repository so to use this we need to install this jar in maven local repository
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
mvn install:install-file -Dfile=C:/oraclexe/app/oracle/product/11.2.0/server/jdbc/lib/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
note:- Cmd should be opened in location of jar only i.e- mvn install:install-file
command must run at jar location only
<!-- ORACLE database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
note:- even one project developed in maven can be added as jar in another
Upvotes: 1