Intellij导入Eclipse的web工程,编译报错
Caused by: java.lang.Error: Unresolved compilation problems: The import org.mybatis cannot be resolved SqlSessionTemplate cannot be resolved to a type SqlSessionTemplate cannot be resolved to a type SqlSessionTemplate cannot be resolved to a type SqlSessionTemplate cannot be resolved to a type SqlSessionTemplate cannot be resolved to a type at com.sunlord.core.db.BaseMyBatisDao.<init>(BaseMyBatisDao.java:19) at com.sunlord.core.db.GenericDao.<init>(GenericDao.java:18) at com.sunlord.platform.dao.admin.WhatsNewDao.<init>(WhatsNewDao.java:11) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) ... 62 more
在Eclipse下编译没有问题,可以成功运行项目,但是Intellij下出错。
项目运行环境设置了jdk1.8.0_51,tomcat也是。
用gradle导入了MyBatis相关jar包 mybatis3.2.6 和 mybatis-spring1.2.2
看看xml文件在编译的时候,是否正确被发布到运行目录下
<spanstyle="font-family:Consolas,'BitstreamVeraSansMono','CourierNew',Courier,monospace;background-color:#FFFFFF;"><spanstyle="background-color:#FF9900;">org.mybatis.spring.<spanstyle="font-family:Consolas,'BitstreamVeraSansMono','CourierNew',Courier,monospace;background-color:#FF9900;">SqlSessionTemplate<spanstyle="background-color:#FF9900;">
<spanstyle="font-family:Consolas,'BitstreamVeraSansMono','CourierNew',Courier,monospace;background-color:#FFFFFF;"><spanstyle="background-color:#FF9900;">
<preclass="brush:xml;toolbar:true;auto-links:false;"><?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd"><!--1.DataSource--><importresource="classpath:config/datasource.xml"/><!--2.SQLsessionfactory--><beanid="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean"><propertyname="dataSource"ref="dataSource"/><propertyname="mapperLocations"value="classpath:mybatis-mapper/**/*.xml"/><!--Mapperxml--></bean><!--3.InstantiateMapper--><beanclass="org.mybatis.spring.mapper.MapperScannerConfigurer"><propertyname="basePackage"value="com.xtuer.dao.mybatis.mapper"/></bean></beans>版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。