简体   繁体   English

如何在maven中指定本地jar的路径

[英]How to specify path for local jars in maven

I am using maven2 to build the java project. 我正在使用maven2来构建java项目。 when I am trying to build using mvn install I am getting the compilation error saying some package xya.abc.aaa doesnot exist. 当我尝试使用mvn install构建时,我收到编译错误,说某些包xya.abc.aaa不存在。 This package is available in my own jar at local disk. 这个包可以在我自己的jar本地磁盘上找到。 This jar(say test.jar) is created by me. 这个jar(比如test.jar)是由我创建的。

How can I tell to maven to use this local jar for the package its looking for is availabe at my local disk? 我怎么能告诉maven使用这个本地jar作为它寻找的包可以在我的本地磁盘上使用?

You need to install the dependencies to your local repository . 您需要将依赖项安装到本地存储库

mvn install:install-file
  -Dfile=<path-to-file>
  -DgroupId=<group-id>
  -DartifactId=<artifact-id>
  -Dversion=<version>
  -Dpackaging=<packaging>
  -DgeneratePom=true

Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM