Maven下载Jar包(bat脚本)

时间:2022-09-29 23:27:09

1、创建一个bat文件叫download.bat

2、里面写入以下代码

call mvn -f pom.xml dependency:copy-dependencies

3、创建pom.xml文件

4、写入内容(把你需要下载的jar包的Maven放入dependencies)

<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.0</modelVersion>

  <groupId>cn.hadron</groupId>
  <artifactId>esapi</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>esapi</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

    <dependencies>
     <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.9.1</version>
        </dependency>
    </dependencies>
</project>

5、双击Bat文件,启动脚本就会自动下载了。