<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
Then running mvn package and java -jar target/vast-ad-server-artifactId-1.0-SNAPSHOT.jar works.
I think you should check the directory structure of the artifact that was built by maven.
Usually, spring boot artifacts are prepared by a special spring boot plugin and not by a maven assembly plugin.
Although it shares the "jar" suffix, it's not really a jar, it has special classloader to load classes from BOOT-INF/lib folder.
I've already provided a detailed answer on what happens exactly when the spring boot application starts here but bottom line if you use assembly plugin you'll have to prepare both manifest file and a fairly complicated structure of folders. Frankly, I think you should use spring boot plugin as a first resort to build spring boot applications.
Adding to all the above answers
right click on project-> Maven ->update project-> force update
This will download all missing dependencies.
Still if it doesn't work ?? right click on pom.xml and run as configuration. Check you are using correct JRE. Then set goal as install and run it.
Important check java version in pom.xml if it doesn't match with your installed JRE version then also you might get this error. So make sure its same.
Still doesn't work?? Delete the project from workspace and import it back.
Rightclickonproject->Maven->UpdateProject->Tick the checkbox Force update of Snapshots/Releases-OK
give time to update the project. Then simply run the application Rightclickonproject->Runas->Spring Boot App
try updating project in maven. Sometimes while adding new dependency it wants maven to be updated there Dev tools won't work
---Right click project
---go to maven
---Update project
Your source file is missing from classpath. For me it happened when I restarted STS.
Go to Run -->Run Configurations- classpath , in user entries add your project.
Go to source tab of Run configurations and add workspace folder and select your src file where your main method class is there.
Click on apply and execute. It will work.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.