Home > OS >  Java Eclipse Maven adding dependency causes the app to fail to run
Java Eclipse Maven adding dependency causes the app to fail to run

Time:11-26

I am in a Java project that uses Maven. When I add a local dependency to the pom.xml file, the app fails to run.

I add the submodule to the dependency list in the pom.xml package, click run in eclipse and it gives me an error. When I remove the dependency from pom.xml file it runs fine.

My question is mainly when I add a dependency to the pom.xml file do I have to do it thru Eclipse in a way or is it fine to write it out? Also after adding the dependency do I need to run a mvn install again?

CodePudding user response:

Eclipse Maven Plugin doesn't see your changes in the pom.xml file automatically. Depending on your changes to the pom.xml file, you need at least to do manually

Right Click on the Project -> Maven -> Update project.

maven update project

Sometimes it doesn't help, and you need to do mvn install and after that Maven -> Update project.

  • Related