【发布时间】:2020-10-04 23:12:38
【问题描述】:
我在 Spring Boot 中的项目。我的项目中有一个外部 jar 文件,我只通过构建路径添加。当我使用 maven clean install 命令运行我的项目时。我收到以下错误消息:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/Code/workspace/NestOrion/src/main/java/orion/trader/individual/IndividualOrderTrader.java:[16,33] package com.omnesys.nestq.classes does not exist
[ERROR] /D:/Code/workspace/NestOrion/src/main/java/orion/trader/individual/IndividualOrderTrader.java:[17,33] package com.omnesys.nestq.classes does not exist
[ERROR] /D:/Code/workspace/NestOrion/src/main/java/orion/trader/individual/IndividualOrderTrader.java:[36,28] cannot find symbol
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>exec</classifier>
<mainClass>
com.orion.main.NestOrionApplication
</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我也根据他们阅读了其他文章,有时在运行时找不到外部 jar 文件路径,因此我们需要 java 类路径(源附件)。所以我通过 Build path > jar > added source attachment 添加。但我仍然得到相同的编译错误。
【问题讨论】:
-
你需要添加你的外部jar作为编译时间
<dependency> -
怎么样?你能告诉我吗?
-
你可以google 'add maven dependency' 有多个资源
-
and I added only through Build path..是什么意思?请显示完整的 pom 文件
标签: java spring-boot maven maven-2 executable-jar