A web (war) project references another web project (jar package)

1. Demand

  A web project is already a separate module, and another web project can be directly referenced, and can be referenced in the form of war, but the referenced module has few functions, and it is only for connecting to the third web module, so it is directly imported. jar

package form.

Second, the realization of ideas

  Directly type the web project into a jar package (no lib file is required, delete some unnecessary files, such as the startup entry class, only need class, and some configuration files), and add it to another web project

3. Problems

  Mainly to record the problems in the process

        The development framework used by the web project that needs to go to the jar package: spring boot + Mybatis + maven

        1. Make a jar package

   It cannot be packaged using the maven tool provided by spring boot. Because the first-level directory packaged by springboot-maven-plugin is Boot-INF, it cannot be referenced.

   Use normal maven tools directly: 

   <build> 
      <plugins>
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <configuration>
            <source>1.8</source>
            <target>1.8 </target>
         </configuration>
       </plugin>
      </plugins>
   </build>
2. The xml configuration file in the imported jar cannot be read.
  If the xml file cannot be found, use the configuration path and   mapper-locations in the form of classpath + *
: classpath * :mapper/**/*.xml
3. The typed jar file still contains extra files . It is
recommended to use 7.zip to directly open and edit the jar file (it will not cause damage to the jar)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325210515&siteId=291194637