Ashutosh Pandey
Ashutosh Pandey

Reputation: 21

Maven: add external JAR to spring boot project while building jar

One external is added as dependency in spring boot project with scope=system. Build is successful and when running the project from eclipse it is successful. But when I am running the project from command project using command java -jar springBoot.jar. then it is failed with below exception :
Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource

Upvotes: 1

Views: 1014

Answers (1)

Ashutosh Pandey
Ashutosh Pandey

Reputation: 21

Add below tag in pom.xml. When adding below tag then it will include jars having scope = system.

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
    <includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>

Upvotes: 1

Related Questions