My project in Spring boot. I have one external jar file in my project and I added only through Build path. When I ran my project using maven clean install command. I got following error message:
[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>
I read other article also as per them some time external jar file path not found at run time so we need to java classpath (Source attachment). So I added through Build path > jar > added source attachment. But Still I am getting the same compile error.
It solved my issue after added my external jar in maven dependency.
Steps:
Name of jar: ReleaseVersion.jar
<dependency>
<groupId>DealerNestQApiReleaseVersion</groupId>
<artifactId>DealerNestQApiReleaseVersion</artifactId>
<scope>system</scope>
<version>1.1</version>
<systemPath>${basedir}/libs/DealerNestQApiReleaseVersion.jar</systemPath>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
By using this steps I solved my issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.