简体   繁体   中英

Spring MVC tutorial project does not build on IntelliJ

I am trying to build and run a Spring MVC beginner lesson project using IntelliJ. I imported the existing project from GitHub. But when I try to build the project I keep getting:

Error:(3, 38) java: package org.springframework.stereotype does not exist
Error:(4, 47) java: package org.springframework.web.bind.annotation does not exist

These external dependencies jars are under my Maven local repositories (C:\\Users\\sudi.m2)and I can see in IntelliJ under Maven->Repositories that repo location is indeed there. I also tried "Invalidate Cache and restart" but that does not help. My M2_HOME is set correctly to C:\\apache-maven-3.2.2. If I try to run mvn install from command line, I get:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.845 s
[INFO] Finished at: 2014-09-25T19:03:21+05:30
[INFO] Final Memory: 9M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war    (default-war) on project basic-web-app: Error assembling WAR: webxml attribute is required    (or preexisting WEB-INF/web.xml if executing in update mode) -> [Help 1]

Any suggestions are appreciated.

If the project doesn't have a web.xml file (IE: Entirely java config based). The build war plugin will fail unless you specify the "failOnMissingWebXml" attribute to false.

Delete you local .m2 repository and let it re-download all needed jars. Maybe, there were issues while downloading one of the dependencies.

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