简体   繁体   English

无法在我的 Spring 引导项目中使用 Maven 依赖项

[英]Unable to use Maven dependency inside my Spring boot project

I have published my artifact to Maven.我已将我的工件发布到 Maven。 Can be accessed here ->https://oss.sonatype.org/#nexus-search;classname~AccessGateLabs可以在这里访问 ->https://oss.sonatype.org/#nexus-search;classname~AccessGateLabs

Thereafter, I have added the dependency,此后,我添加了依赖项,

<dependency>
   <groupId>com.accessgatelabs.oss</groupId>
   <artifactId>response-builder</artifactId>
   <version>1.0.2</version>
</dependency>

The dependency got added and I can see the jar inside the Maven dependency folder (screenshot attached)添加了依赖项,我可以在 Maven 依赖项文件夹中看到 jar(附截图) 添加了依赖项的屏幕截图

After this, I am unable to import the class from this dependency.在此之后,我无法从此依赖项中导入 class。

在此处输入图像描述

Thanks!谢谢!

The problem is that you have deployed an uber-jar containing Sping classes, not your own library with you classes.问题是您已经部署了一个包含 Sping 类的 uber-jar,而不是您自己的类库。 You see in the archive browser when browsing the jar that the root directory is "org/springframework/boot"您在浏览 jar 时在存档浏览器中看到根目录为“org/springframework/boot”

The solution is to not use the Spring plugin for packaging, but the default maven jar packaging plugin.解决方法是不使用 Spring 插件进行打包,而是使用默认的 maven jar 打包插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Spring Boot Maven项目作为依赖项 - Using a Spring boot maven project as a dependency 如何在我的Spring Boot项目中使用不依赖的类 - How to use class which is not a dependency in my spring boot project 强制maven spring boot项目使用旧版本的依赖项而不是其他依赖项的新版本 - Forcing maven spring boot project to use older version of a dependency instead of a new version from another dependency 无法将Spring MVC依赖项添加到Maven项目 - Unable to add Spring MVC dependency to Maven Project 行家! Spring Boot 采用了依赖项目中提到的错误依赖版本 - MAVEN! Spring Boot takes wrong dependency version mentioned in dependency project 使用Spring Boot无法在项目中找到命令Maven - Unable to locate command maven in project with spring boot 将 spring boot maven 项目作为依赖添加到另一个项目(本地) - Add spring boot maven project as dependency to another project (locally) Spring Boot会为另一个项目抛出带有maven依赖关系的ClassNotFoundException - Spring Boot throws ClassNotFoundException with maven dependency for another project 在一个简单的 Maven 项目中找不到依赖 spring-boot-starter-security - The dependency spring-boot-starter-security is not found in a simple Maven project spring boot中依赖注入失败,基于maven的多模块项目 - Dependency Injection failed in spring boot , maven based multiple modules project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM