Mac系统用Maven本地引入jar包报错问题解决

打包命令

mvn install:install-file -Dfile=/Users/用户名/tool/selenium-server-standalone-3.9.1.jar -DgroupId=org.selenium -DartifactId=selenium-server-standalone -Dversion=3.9.1 -Dpackaging=jar

注意:
如果没有配置全局环境变量,请找到你maven文件夹,在文件夹的bin目录中进行命令。


-Dfile -> jar包的路径
-DgroupId -> 对应maven依赖中的groupId
-Dversion -> 对应maven依赖中的Dversion,版本号
-DartifactId -> 对应maven依赖中的DartifactId

常见错误

maven目录里的setting.xml文件中节点的地址和你本地仓库地址不匹配

<!--
  <localRepository>/java/maven/apache-maven-3.6.3/properties</localRepository>
-->

<!-- 一般idea使用的本地仓库地址 -->   
<localRepository>/Users/mac/.m2/repository</localRepository>

上传成功

在pom.xml文件中按照格式添加依赖就可以了

     <dependency>
            <groupId>org.selenium</groupId>
            <artifactId>selenium-server-standalone</artifactId>
            <version>3.9.1</version>
        </dependency>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章