There is no class problem when Maven publishes jar package

straight left 2021-02-23 16:03:12
class problem maven publishes jar


We have a public class library , Translate it into jar package , For other projects .

Ran goose , There's a project that's also compiled into a jar package , Run on the command line , The result shows that the public class library cannot be found .

Open the project jar package , There is a public class library jar Bag . It's just , It's not like the general jar Bag together , For example

BOOT-INF\lib

It's in

BOOT-INF\classes\libs

That's probably why , The runtime couldn't find . Why put it here , I can't find it ? I do not know! . I don't know why yet . however , The development phase , stay idea It works well in the classroom . It's still a matter of packing .

Why is the public library package placed in BOOT-INF\classes\libs Well ? The reason is that the way of dependency is written like this :

<dependency>
<groupId>com.monkey</groupId>
<artifactId>lt-framework</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${
project.basedir}/src/main/resources/libs/lt-framework-1.0.0.jar</systemPath>
</dependency>

 Insert picture description here
The advantage of this is , In the case of multi person development , The version of the dependency package is consistent . Of course , You can also publish packages to an internal repository , But we didn't do it . In a word! , Using the above , Look for package dependencies in the local folder , There's something wrong , What do I do ?

In fact, in the pom.xml Of build Make a statement in :

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>

After this is released , The public package will also be copied to BOOT-INF\libBOOT-INF\classes\libs Still have , waste , I don't know how to set it ), Running normally .

版权声明
本文为[straight left]所创,转载请带上原文链接,感谢
https://javamana.com/2021/02/20210223155924209y.html

  1. Spring can still play like this! Ali's new spring product has successfully overturned my understanding of spring!
  2. IntelliJ idea can also draw mind maps. It's really the strongest ide!
  3. JavaScript performance optimization [inline cache] V8 engine features
  4. linux 配置java环境
  5. linux find 查找文件
  6. 深入理解 Web 协议 (三):HTTP 2
  7. IntelliJ IDEA 相关问题记录
  8. Deep understanding of Web protocol (3): http 2
  9. 深入理解 Web 协议 (三):HTTP 2
  10. 腾讯IEG开源AI SDK:自动化测试吃鸡、MOBA类游戏
  11. Mysql Command
  12. Configuring Java environment with Linux
  13. Find files in Linux
  14. docker-Dockerfile 创建镜像
  15. Redis Cluster
  16. 深入理解 Web 协议 (三):HTTP 2
  17. JavaScriptBOM操作
  18. JavaScriptBOM操作
  19. Deep understanding of Web protocol (3): http 2
  20. Record of IntelliJ idea related problems
  21. Deep understanding of Web protocol (3): http 2
  22. Tencent IEG open source AI SDK: automatic testing of chicken eating and MoBa games
  23. Mysql Command
  24. Docker dockerfile create image
  25. Redis Cluster
  26. 死磕Spring之IoC篇 - 文章导读
  27. Deep understanding of Web protocol (3): http 2
  28. JavaScript BOM operation
  29. JavaScript BOM operation
  30. 死磕Spring之IoC篇 - 文章导读
  31. k8s node 操作与维护
  32. k8s 证书更新
  33. 【Java面试题第三期】JVM中哪些地方会出现内存溢出?出现的原因是什么?
  34. HashMap连环问你能答出几道?
  35. k8s-cronjob
  36. k8s-cert
  37. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  38. 什么是HTTPS以及如何实施HTTPS?
  39. Spring: an introduction to IOC
  40. Spring: an introduction to IOC
  41. Operation and maintenance of k8s node
  42. K8s certificate update
  43. vue使用sdk进行七牛上传
  44. k8s-dns
  45. JavaScript 邮箱验证 - 正则验证
  46. k8s-dashboard
  47. HashMap连环问你能答出几道?
  48. Where does memory overflow occur in the JVM? What are the reasons for this?
  49. How many questions can you answer?
  50. k8s-cronjob
  51. spring注解--Transactional
  52. k8s-cert
  53. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  54. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  55. 【k8s集群】搭建步骤
  56. k8s-kubeadm
  57. k8s-etcd
  58. What is HTTPS and how to implement it?
  59. Java中使用HashMap改进查找性能
  60. maven发布jar包运行时找不到类问题