【问题标题】:Exception in thread "main" java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories线程“main”中的异常 java.lang.IllegalArgumentException:在 META-INF/spring.factories 中找不到自动配置类
【发布时间】:2020-11-13 03:15:19
【问题描述】:

我在将JAR 导出为可从Eclipse 运行时遇到问题。

尝试使用maven plugin, spring-boot plugin & simple java project export。 但是,它显示 spring.factories 文件相关错误。我已经在谷歌检查后复制并粘贴到所需的文件夹中。

我需要导出一个spring-boot application,其中包括一些3rd party JARs 和maven jars(要从pom.xml 下载)和属性文件。

Jar 应该从控制台运行或使用系统中的批处理文件。

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

【问题讨论】:

  • 你在使用springs自动配置吗?
  • 我都试过了。 1. Maven 构建插件并尝试使用全新安装、全新重新打包:重新打包、全新测试等,但无法正常工作。 2. 如果我是正确的,是的,我正在使用 Springs 自动配置。使用 EnableAutoConfiguration 注解。另外,在 pom.xml 中:com.tcs.stest.adapter.itsm.initBatch.Application 如果我对自动配置的理解是错误的,请纠正我,因为我是 Springboot 的新手。
  • 大家好:我认为缺少一些与 springboot 应用程序相关的插件。我正在创建 springboot 项目,然后添加 maven 依赖项。但是在创建 maven 项目之后,添加 springboot 依赖项就可以了。谢谢大家的时间。 (y)

标签: java spring-boot maven-assembly-plugin spring-boot-maven-plugin


【解决方案1】:

Terminal中运行以下命令

mvn install

没有测试

mvn install -DskipTests

mvn install -DskipTests=true

jar 将在/target 文件夹中可用

【讨论】:

  • 上述命令出现以下错误:使用 -Xlint 重新编译:详细信息未选中。[INFO] --------- ---------------------------------------- [错误] 编译错误:[信息] - -------------------------------------------------- ---------- [错误] /C:/Users/pc/Desktop/xx/Eclipse-Workspace-Root/JAR_Creation_Example/NewAxway/src/main/java/com/*.java:[3, 21] 包 com.*.*.bs 不存在
  • -Xlint:unchecked 已弃用警告。这不是原因。缺少一些library,这是line 3 所必需的。为什么不在pom.xml 中添加所有必需的依赖项?
猜你喜欢
  • 2018-04-14
  • 2020-11-26
  • 2020-08-19
  • 2018-08-27
  • 1970-01-01
  • 1970-01-01
  • 2018-09-17
  • 2017-09-21
  • 2016-12-12
相关资源
最近更新 更多