Maven----将手动下载的jar包以命令行的方式安装到本地MavenRepository中
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包.
小小小的老婆和小小小小的我!
posted on 2017-12-29 22:16 mywifelidan 阅读(1773) 评论(0) 编辑 收藏 举报