Springboot multi-module dependent project packaging error

The springboot multi-module project runs well locally. Once packaged, the class cannot be found, the symbol cannot be found, etc.

 

The project parent contains the following items

Project base

Project A (depending on the base project)

Project B (depending on the base project)

 

When we used maven to package, we found that there was an error, the class could not find the symbol, etc.

 

1. First use the maven plugin in the pom file of the parent project

 <plugins>
   <plugin>
      <!-- 指定JDK编译版本 -->
      <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <configuration>
         <source>1.8</source>
         <target>1.8</target>
         <encoding>UTF-8</encoding>
       </configuration>
   </plugin>
    <!-- 打包跳过测试 -->
   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
       <configuration>
          <skipTests>true</skipTests>
          </configuration>
   </plugin>
   <!-- 避免font文件的二进制文件格式压缩破坏 -->
    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-resources-plugin</artifactId>
       <configuration>
          <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                        <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>svg</nonFilteredFileExtension>
           </nonFilteredFileExtensions>
        </configuration>
    </plugin>
</plugins>

2. Do not use buid for the base project module, comment out

3. Other modules can normally rely on the base module and use the maven plugin

4. Refresh maven, you can package normally

Remember to clean first and then package

 

 

 

 

Published 115 original articles · Like 58 · Visits 160,000+

Guess you like

Origin blog.csdn.net/luChenH/article/details/103069766