简体   繁体   中英

Maven install works but Intellij's build does not

I have the following problem with a multi module maven project:

The project was initially created in Eclipse and can be compiled and run there. It also can be built with mvn install .

Now when I import the project into Intellij using the following import options the parent pom.xml is recognized and the project and its modules are imported.

Everything looks fine, but when I try to compile it, one class, that has a class from another module as a dependency, cannot be found.

I tried a lot of solutions and the ONLY one that worked for me is the outdated maven idea plugin mvn idea:idea as suggested in this thread. Now every time something in any of the projects poms changes, I have to rerun mvn idea:idea and hope that it works - otherwise I have to import the whole project again.

What am I doing wrong in the import process? Why does mvn install on the command line work, but building the project in Intellij does not?

Try to clear the Intellj Cache once by going to File -> Invalidate Caches/Restart click it. You will get an options, In there select Invalidate and Restart.

Re-import the maven project and compile again it should work.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM