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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章