Java 将spring应用程序打包到可执行jar中会导致';无法读取架构文档';
我已经使用以下pom.xml/maven配置将spring应用程序打包到可执行jar中Java 将spring应用程序打包到可执行jar中会导致';无法读取架构文档';,java,spring,maven,jar,Java,Spring,Maven,Jar,我已经使用以下pom.xml/maven配置将spring应用程序打包到可执行jar中 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <pha
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
com.some.Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
当在eclipse中不使用jar打包运行时,同样的应用程序执行良好。我确信这不是依赖性问题,我已经提供了适当的依赖性。
问题发生的原因是包装到罐子中。
请帮忙,谢谢您的时间。为什么要使用SpringBootMaven插件来构建jar?以下是示例
org.apache.maven.plugins
maven编译器插件
3.3
${java.version}
${java.version}
${project.build.sourceEncoding}
真的
org.springframework.boot
springbootmaven插件
com.some.Main
Thank you@jacky neo使用spring boot插件打包jar为我解决了这个问题。尽管在使用maven打包插件时仍然无法找出问题的根本原因,但很高兴听到您的解决方案。SpringBoot应用程序是胖罐子。所以我们总是使用spring插件来构建jar。ApacheMaven插件需要更多的设置来完成您想要的工作。我也不知道了。当无法从maven存储库下载时,我使用apache插件将第三个jar添加到spring boot应用程序jar中。
Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 70; cvc-elt.1.a: Cannot find the declaration of element 'beans:beans'.