关于maven工程中创建私有库的问题

这两天在帮着将一些旧的工程迁入maven框架,其中有个jar包“aliyun-java-sdk-dysmsapi-1.0.0.jar”居然在maven官方库中找不到。

迫不得已,只好将旧工程中的jar包独立部署到私有库中。

开始执行:

mvn install:install-file -Dfile=aliyun-java-sdk-dysmsapi-1.0.0.jar -DgroupId=com.aliyun -DartifactId=aliyun-java-sdk-dysmsapi -Dversion=1.0.0 -Dpackaging=jar

结果噼里啪啦的蹦出错误:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.070 s
[INFO] Finished at: 2017-09-26T14:34:21+08:00
[INFO] Final Memory: 6M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\Project\Java\web-knn\lib). Please verify you invoked Maven from the correct directory. -> [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/MissingProjectException

言下之意是说该目录下缺乏POM文件啥的。但本来这个旧项目就是非maven框架的项目,何来的POM文件呢?

百思不得其解,找了一圈解决方案,包括试图在目录下建一个pom.xml都不行。

最后看到了这个贴:https://stackoverflow.com/questions/16348459/error-the-goal-you-specified-requires-a-project-to-execute-but-there-is-no-pom

才知道这里的一个坑:原来每个参数都需要使用双引号包裹起来...真是无语!

正确的指令应该是:

mvn install:install-file "-Dfile=.\aliyun-java-sdk-dysmsapi-1.0.0.jar" "-DgroupId=com.aliyun" "-DartifactId=aliyun-java-sdk-dysmsapi" "-Dversion=1.0.0" "-Dpackaging=jar"
OK,执行成功!

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing D:\Project\Java\web-knn\lib\aliyun-java-sdk-dysmsapi-1.0.0.jar to C:\Users\DELL\.m2\repository\com\aliyun\aliyun-java-sdk-dysmsapi\1.0.0\aliyun-java-sdk-dysmsapi-1.0.0.jar
[INFO] Installing C:\Users\DELL\AppData\Local\Temp\mvninstall2482964083783898455.pom to C:\Users\DELL\.m2\repository\com\aliyun\aliyun-java-sdk-dysmsapi\1.0.0\aliyun-java-sdk-dysmsapi-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.489 s
[INFO] Finished at: 2017-09-26T14:29:06+08:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值