使用maven下载jar包
1、建一个pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0modelVersion> <groupId>com.companny.mavengroupId> <artifactId>helloartifactId> <version>0.0.1-SNAPSHOTversion> <dependencies> <dependency> <groupId>junitgroupId> <artifactId>junitartifactId> <version>4.12version> <scope>testscope> dependency> dependencies> project>
2、在该pom.xml所在目录:
cmd下:输入以下命令:
mvn dependency:copy-dependencies
3、下载完成后的jar在dependency的目录下
4、将下载的jar包加入仓库:
下载的jar路径 参数2 参数3 版本
mvn install:install-file -Dfile="c:\javaee\hello\target\dependency\junit-4.12.jar" -DgroupId=junit -DartifactId=junit -Dversion=4.12 -Dpackaging=jar