参考:
https://blog.youkuaiyun.com/rickiyeat/article/details/79386000
http://www.allatori.com/doc.html
https://zengyouyuan.iteye.com/blog/1947186
需要编辑的文件
1)pom.xml中添加插件
2)allatori.xml文件配置
3)jar包引用
4)maven命令
===============================================================
1)pom.xml中添加插件
<build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <!-- mybatis generator 自动生成代码插件 --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>${mybatis-generator-maven-plugin-version}</version> <configuration> <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile> <overwrite>true</overwrite> <verbose>true</verbose> </configuration> </plugin> <!-- Allatori plugin start --> <!-- Copying Allatori configuration file to 'target' directory. The destination file will be filtered (Maven properties used in configuration file will be resolved). --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>copy-and-filter-allatori-config</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target</outputDirectory> <resources> <resource> <directory>${basedir}/allatori</directory> <includes> <include>allatori.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> <!-- Running Allatori --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <executions> <execution> <id>run-allatori</id> <phase>package</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>java</executable> <arguments> <argument>-Xms128m</argument> <argument>-Xmx512m</argument> <argument>-jar</argument> <!-- Copy allatori.jar to 'allatori' directory to use the commented line --> <argument>${basedir}/lib/allatori.jar</argument> <!-- <argument>${basedir}/allatori/allatori.jar</argument> --> <argument>${basedir}/allatori/allatori.xml</argument> </arguments> </configuration> </plugin> <!-- Allatori plugin end --> </plugins> </build>
2)allatori.xml文件配置
<config> <input> <!-- <dir in="../target/classes/" out="../target/filebim/WEB-INF/classes/"/>--> <dir in="../target/classes/" out="../target/classes/"/> </input> <keep-names> <class access="protected+"> <field access="protected+"/> <method access="protected+"/> </class> <!-- <class template="class com.bimbdip.config.*"/>--> </keep-names> <classpath> <!-- Adding library.jar to the classpath --> <!-- <jar name="library.jar"/>--> <!-- Adding all jars in the lib directory to the classpath --> <!-- <jar name="lib/*.jar"/>--> <!-- Adding all jars in the lib2 directory and its subdirectories to the classpath --> <jar name="../target/filebim/WEB-INF/lib/**/*.jar"/> <jar name="../lib/**/*.jar"/> </classpath> <property name="log-file" value="log.xml"/> </config>
3)jar包引用
从官网下载allatori.jar http://www.allatori.com/doc.html
tomcat-embed-core-9.0.13.jar
4)maven命令
mvn clean package org.codehaus.mojo:exec-maven-plugin:1.6.0:exec war:war