1. 程式人生 > >Maven----將手動下載的jar包以命令行的方式安裝到本地MavenRepository中

Maven----將手動下載的jar包以命令行的方式安裝到本地MavenRepository中

spring finish cal mis boot body exce art failed

1.情景再現:準備實現SprintBoot的熱部署功能,因沒有對應jar時,在Eclipse中mvn install 會報錯:

  報錯信息:

[INFO] --- spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) @ spring-boot ---
[WARNING] The POM for org.springframework:springloaded:jar:1.2.4RELEASE is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------ [INFO] Total time: 1.328 s [INFO] Finished at: 2017-12-29T21:31:02+08:00 [INFO] Final Memory: 13M/33M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.springframework.boot:spring
-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project spring-boot: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run failed: Plugin org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE or one of its dependencies could not be resolved: Failure to find org.springframework:springloaded:jar:1.2
.4RELEASE in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

2. 因Maven無法自動從網上倉庫下載到相應的jar包,所以需要手動進行安裝到本地MavenRepository中

  命令格式如下:

mvn install:install-file -Dfile=jar包的位置(參數一) -DgroupId=groupId(參數二) -DartifactId=artifactId(參數三) -Dversion=version(參數四) -Dpackaging=jar

  參數一:Jar包所在的位置

  參數二:jar包的groupId

  參數三:jar包的artifactId

  參數四:jar包的版本號

3.實際操作:如下圖

技術分享圖片

4. 特別註意事項:

  4.1 註意"-"不能缺少 install後面的"-"是沒有空格的
  4.2 註意"-Dfile"中jar包的路徑和jar包的名字.
  4.3 註意看cmd命令提示,查看本地repository中是否成功的復制了jar包.

Maven----將手動下載的jar包以命令行的方式安裝到本地MavenRepository中