使用Maven下载jar包

有些开源项目不直接提供jar包的下载,而是建议使用Maven下载,以开源库hipster(https://github.com/citiususc/hipster,http://www.hipster4j.org/)为例,使用Maven下载的配置方式如下:

<dependencies>
  <!--
    Add this dependency under your pom.xml <dependencies> section to add
    all the dependencies of Hipster to your project. Add hipster-core
    instead of hipster-all for core functionality.
  -->
  <dependency>
    <groupId>es.usc.citius.hipster</groupId>
    <artifactId>hipster-all</artifactId>
    <version>1.0.0</version>
  </dependency>
</dependencies>

我们可以使用IDEA创建一个Maven工程,然后使用以上的配置方式来下载Hipster的jar包。使用方法如下:

1)创建一个新工程

2)选择创建Maven工程

3)GroupId等信息随便填写。

4)填写工程名称

5)工程创建完成之后,点击工程目录下的pom.xml文件,可以看到文件内容如图所示

6)使用<dependencies>标签填写hipster相关的<groupId>和<artifactId>,以及<version>

7)书写完成后,点击右侧的“Maven Project”,此时显示的内容只有,“Lifecycle”和“Plugins”。

8)点击左上角的刷新按钮,就开始下载我们指定的jar包,下载完成后如左侧所示。

9)

点击“Maven Project”的设置按钮,可以查看下载jar包的存放路径。

原文地址:https://www.cnblogs.com/lz3018/p/5351966.html