1、直接找到需要的jar下载到本地,然后安装到maven
打开CMD,进入到H:\test(下载的jar目录)目录,然后执行下面命令:
mvn install:install-file
-DgroupId=nl.justobjects
-DartifactId=pushlet
-Dversion=2.0.4
-Dpackaging=jar
-DgeneratePom=true
-Dfile=pushlet-2.0.4.jar
其中我们需要知道官方的groupId、artifactId、version
2
settings.xml添加 如下 内容 访问 开源中国的jar 下载源
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.NET/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
</settings>