SSBuild创建遇到的问题

本文最后更新于:1 年前

1,项目结构

image-20210328154204364

2,资源导出问题

开始没有配置好,导致 target/classes/ 下没有各种资源配置文件。其次在用非模板创建web项目,com/pnca/只有dao层的BookMapper文件,其他文件没有打包不知道为什么?

<build>
   <resources>
      <resource>
         <directory>src/main/java</directory>
         <includes>
            <include>**/*.properties</include>
            <include>**/*.xml</include>
         </includes>
         <filtering>false</filtering>
      </resource>
      <resource>
         <directory>src/main/resources</directory>
         <includes>
            <include>**/*.properties</include>
            <include>**/*.xml</include>
         </includes>
         <filtering>false</filtering>
      </resource>
   </resources>
</build>

在pom.xml中配置静态资源导出

3,一些注解问题

在Controller层中,对于IDEA的提示,尤其是error最好立即处理,不要试图通过修改警告级别来掩饰错误。

4,spring-mvc.xml的beans出错

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd">
</beans>

由于IDEA一般会自动导入

http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd

但是我们还需要手动导入

http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd"


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!