做微应用的时候遇到需求方给的jar包,上架就不能运行,报找不到jar包错误。终于找到解决办法,需要在pom中设置repo,依赖。
![](https://img.haomeiwen.com/i1369744/c0918cee1f106996.png)
![](https://img.haomeiwen.com/i1369744/ff7bbd25e334756c.png)
然后设置maven层级约束。这点要十分谨慎,严格遵守约束,一点不对还是报错。
层级如下:
![](https://img.haomeiwen.com/i1369744/5dfeb3c5a3afb5ac.png)
在根目录层建lib→org→richard→xxx→1.0→xxx-1.0.jar
然后clean项目。不放心再maven clean下。然后maven update就可以了。在.m2/repository/org/richard/看层级是否一致。
jar包及路径必须严格遵循格式:
/groupId/artifactId/version/artifactId-verion.jar
我的: lib/org/richard/my-jar/1.0/my-jar-1.0.jar
网友评论