我在运行 jar 时得到了 classNotFound。此类存在于通过构建路径添加的外部 jar 中。在出现编译时错误之前,我在 pom.xml 中添加了以下代码。所以现在我没有收到编译时错误,但现在我在运行该可执行 jar 时遇到了错误。
我也根据他们阅读了其他文章,有时在运行时找不到外部 jar 文件路径,因此我们需要 java 类路径(源附件)。所以我通过 Build path > jar > added source attachment 添加。但仍然是在运行时找不到该类。
Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>spring-boot</classifier>
<mainClass>
com.main.Application
</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
错误页面:
