如何在Maven中指定本地JAR包的路径

4
我正在使用maven2构建Java项目。当我尝试使用mvn install进行构建时,我会遇到编译错误,提示某些包xya.abc.aaa不存在。这个包在我自己创建的本地磁盘jar文件中是可用的(假设为test.jar)。
我该如何告诉maven使用这个本地jar文件以便找到它所需的包呢?
1个回答

6

你需要将依赖项安装到本地仓库

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接