Maven project manually import jar package dependencies
Manually add:
1. Click file===>project Structure===>modules
2. Click dependencies, then click the plus sign on the right, select the first JARs or directories
3. Select the downloaded dependency jar package, and then keep clicking OK.
4. Click External Libraries under the project on the left, and you will find that the jar package you just added already exists.
5. However, if you use maven to package at this time, an error will be reported, prompting that xxx.jar does not exist
. The jar package is manually added to the local maven warehouse
- Click Terminal at the bottom of idea to enter the Windows command prompt
- Execute the following command: see build success, it means success
mvn install:install-file -Dfile=D:\国网大数据\hadoopapi-cdh5.7-V2.003.jar -DgroupId=com.hadoop -DartifactId=hadoopApi-V2-003 -Dversion=2.0.0.3 -Dpackaging=jar
- 1
-DgroupId对应为pom文件中的groupId
-DartifactId对应为pom文件中的artifactId
-Dversion对应为pom文件中的version
-Dpackaging导入包的类型是jar包的话就是jar
-Dfile你下载下来的jar包放的路径
运行命令后便可以在本地maven资源库中看到对应的jar包
然后重新执行mvn clean install编译打包即可
- Then you can see the dependency just added in the local warehouse of maven
- Then add in pom:
<dependency>
<groupId>com.hadoop</groupId>
<artifactId>hadoopApi-V2-003</artifactId>
<version>2.0.0.3</version>
</dependency>
Transfer from: https://blog.csdn.net/weixin_44455388/article/details/100926697