springframework source in Idea Intellij

二次信任 提交于 2020-01-13 05:15:48

问题


I'm having hard time to setup springframework code in Intellij.

I git-cloned springframework project from github, and ran ant task to get all the libraries into ivy-cache directory. I found "spring-framework.ipr" file for intellij project, and opened it. Unfortunately, some of the libraries are not correctly mapped to the jar files or missing. So I cannot compile the codebase in IDE.

I also tried importing as eclipse project into intellij. Jar file reference seems ok. But there are compilation errors in OXM module. Some test classes have reference to auto generated classes such as "~.samples.flight.FlightDocument", "~.jaxb.test.FlightType", and they don't exist(ant test goal generates them in target dir). It seems same problem happens in STS.

I referenced this blog post: http://blog.springsource.org/2009/03/03/building-spring-3/

Any good idea to setup spring code in intellij?
I use intellij v11.

git branch: 3.1.x
git commit: e8fc90ce3e4554f14eaa86ce05591249d3fe62fa

Compilation error example:

.../org.springframework.oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller Tests.java

Error:(29,42) package org.springframework.samples.flight does not exist
Error:(30,42) package org.springframework.samples.flight does not exist
Error:(44,9) cannot find symbol class FlightsDocument
Error:(44,58) package FlightsDocument does not exist
....

Thanks,


回答1:


problem solved.

"spring-framework.ipr" is the one for intellij.

lesson learned:

  • simply wrong version of junit was referenced in spring-framework.ipr file.
  • when ant build failed middle of the test, subsequent module won't be built. so, required libraries won't be downloaded into ivy-cache/repository.
  • "ant jar" goal will not download test related libraries since the goal doesn't run tests

After all the tests passed and manually fixed junit reference, intellij finally has no errors.



来源:https://stackoverflow.com/questions/8867690/springframework-source-in-idea-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!