第一步:准备需要手动添加的jar包。(存储到本地磁盘)
第二步:打开Maven,点击执行Maven目标。如下图所示:
地址格式如下:
mvn install:install-file -Dfile=jar包路径.jar -DgroupId=自定义的groupid -DartifactId=自定义的artifactId -Dversion=自定义的版本号 -Dpackaging=jar
对应pom.xml文件格式如下:
<dependency>
<groupId>自定义的groupid</groupId>
<artifactId>自定义的artifactId</artifactId>
<version>自定义的版本号</version>
</dependency>
示例如下
maven地址格式:
mvn install:install-file -Dfile=D:\Users\lsx\Desktop\ojdbc7-12.1.0.2.0.jar -DgroupId=com.ojdbc -DartifactId=com-ojdbc-jar -Dversion=1.0.0 -Dpackaging=jar
pom.xml文件格式:
<dependency>
<groupId>com.ojdbc</groupId>
<artifactId>com-ojdbc-jar</artifactId>
<version>1.0.0</version>
</dependency>
第三步:pom.xml文件中添加该依赖,在<dependencies>
标签内添加一个新的<dependency>
标签来实现。如下所示:
<dependencies>
<dependency>
<groupId>com.ojdbc</groupId>
<artifactId>com-ojdbc-jar</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
示意:groupId
、artifactId
和version
分别表示库的组织ID、库的名称和版本号。
注意:添加过后需要刷新Maven。