Maven构建失败
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project oecp: Compilation failure
原因:jre配置错误,在window-prrferences中配置成jdk,maven build过程用jdk编译,如下图错误就好了
错误出现时地址原来是D:\Java\jre7\bin\javaw.exe!!这怎么可能对呢?jre怎么能编译Java文件呢。改完路径就ok了
重新运行又出了一个新的错误:删除target目录失败,我想手动删除它又不让,查了资料说target目录可能被占用,于是直接eclipse重启,问题果然解决了。虽然有点暴力。。。。。后来发现每次都要重启。为什么???????
Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project taotao-manager-web: Failed to clean project: Failed to delete F:\Workspace\taotao-manager\taotao-manager-web\target\tomcat\logs\access_log.2016-10-23 -
之后就启动成功了:访问地址 http://localhost:8080/item/536563,又报错了
Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample这个很好理解,没有绑定mapper映射文件
此路径下并没有映射文件,所以会报错
解决如下:
修改taotao-manager-mapper的pom文件
在pom文件中添加如下内容:
<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</ build >
遗留问题
解决
1.找到eclipse的project菜单选择clean...选项
2.选择Clean all projects 或者 Clean projects selectd blow(选择此项必须勾选出错的项目)
3.等着progress视图里的build完成,你就会发现现在已经不再出现错误了!
运行项目又出错了哭
解决:在springmvc.xml中加入 后来这段注释掉,程序依然可以运行,应该就会没有添加依赖的原因
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>
text/html;charset=UTF-8
</value>
</list>
</property>
</bean>
<bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
在web模块加入依赖
<!-- json -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
再次访问就可以了,但是视频没有这些操作