maven相关部署到私服,jar中不包含xml文件

配置maven私服,需要在pom中配置如下,然后deploy:

  <distributionManagement>
    <repository>
      <id>releases</id>
      <name>Nexus Release Repository</name>
      <url>http://192.168.168.168:8081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
      <id>snapshots</id>
      <name>Nexus Snapshot Repository</name>
      <url>http://192.168.168.168:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

将jar放到maven私服时,执行mybatis报如下错误:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.rs.cloud.business.core.tools.selfCode.mapper.SelfCodeMapper.updateData

怀疑是mapper或者xml没有扫描到,通过添加@Mapper和@MapperScan问题没有解决。后来因为打的jar包没有 xml文件,在pom中添加如下即可:

  <build>
    <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.xml</include>
          <include>**/*.json</include>
          <include>**/*.ftl</include>
        </includes>
      </resource>
    </resources>
 
  </build>

 

posted @ 2022-06-22 14:41  技术白菜  阅读(1)  评论(0)    收藏  举报