Search code examples
eclipsemavenspring-bootmaven-3spring-boot-maven-plugin

Build failure in Spring-boot-starter project due to missing WebApp libraries


I have a Spring-Boot-Starter-project in Eclipse Oxygen 4.7.0 and is trying to build a .war for deployment on an EC2 instance. I have added two jars to allow JDBC connectivity to PostgresSQL DB server from my deployed war.

location of added jars in spring-boot-starter project

I have also added the src/main/webapp/WEB-INF/lib path to the project build path as shown below

src/main/webapp/WEB-INF/lib path is added to Java build path

However, I am getting the Compilation error when I am doing mvn compile with a build failure stating the reason as unavailability of the jar classes

Any help will be really appreciated

enter image description here


Solution

  • You have configured Project build path in your eclipse, and it will not impact anything when you are doing mvn compile. Maven will not include the jar from the lib folder as it does not know lib folder's presence. You should apply either of below two options:

    a. If those jars are present in maven repository then update your pom to read from maven repository directly. b. Install these jars in your local repository then refer it in your pom.xml, check https://stackoverflow.com/a/30209982/3530898 for details