下载maven依赖的方法步骤

来源:互联网 发布:linux signal定义 编辑:程序博客网 时间:2024/05/29 17:30

下载maven依赖的具体步骤如下:

1、 打开https://mvnrepository.com/连接,搜索你想要的依赖名称
这里写图片描述
2、 选择相应的版本
这里写图片描述
3、 创建一个空的文件夹,新建pom.xml文件。

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>    <groupId>temp.download</groupId>    <artifactId>temp-download</artifactId>    <version>1.0-SNAPSHOT</version>     <dependencies>    ***<dependency>        <groupId>org.springframework.cloud</groupId>        <artifactId>spring-cloud-starter-eureka-server</artifactId>        <version>1.2.3.RELEASE</version>    </dependency>***    </dependencies> </project>

4、 将第二步中选择的版本依赖替换掉第三步中带*号部分
这里写图片描述
5、 在pom.xml同级创建download.bat文件,内容如下:
call mvn -f pom.xml dependency:copy-dependencies
@pause
6、 点击运行download.bat文件,其会自动下载所需依赖包。在/target/dependency文件夹中既能看到你想要的jar包。