Maven 添加本地jar包到库里

论坛 期权论坛 脚本     
匿名技术用户   2021-1-4 07:13   11   0

先看错误提示:

[ERROR] Failed to execute goal on project mlcp: Could not resolve dependencies for project com.mlcp:mlcp:jar:0.0.1-SNAPSHOT: Could not find artifact Mxgraph:mlcp:jar:1.0 in ukmaven (http://uk.maven.org/maven2/) -> [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/DependencyResolutionException

或者:

[ERROR] Failed to execute goal on project mlcp: Could not resolve dependencies for project com.mlcp:mlcp:jar:0.0.1-SNAPSHOT: Failure to find Mxgraph:mlcp:jar:1.0 in http://uk.maven.org/maven2/ was cached in the local repository,
resolution will not be reattempted until the update interval of ukmaven 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/DependencyResolutionException

这个原因是这个库在镜像里没有。当然没有啊,这是我本地别的项目的jar包

接着看我maven的配置,就是这个包找不到。

       <dependency>
            <groupId>Mxgraph</groupId>
            <artifactId>mlcp</artifactId>
            <version>1.0</version>
        </dependency>

最后看代码:

mvn install:install-file   -Dfile=C:\Users\Administrator\Desktop\mlcp-1.0.jar  -DgroupId=Mxgraph  -DartifactId=mlcp -Dversion=1.0  -Dpackaging=jar

解释一下:
-Dfile:你要添加的jar包

-DgroupId -DartifactId -Dversion:和你的maven对应起来

-Dpackaging:你添加的包的类型

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP