`

mybatis-generator-maven-plugin

阅读更多

1、使用mybatis的maven的plugin,在pom.xml中添加

 

<plugin>
	<groupId>org.mybatis.generator</groupId>
	<artifactId>mybatis-generator-maven-plugin</artifactId>
	<version>1.3.2</version>
	<configuration>
		<configurationFile>generatorConfig.xml</configurationFile>
		<verbose>true</verbose>
		<overwrite>true</overwrite>
	</configuration>
	<executions>
		<execution>
			<id>Generate MyBatis Artifacts</id>
			<goals>
				<goal>generate</goal>
			</goals>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>org.mybatis.generator</groupId>
			<artifactId>mybatis-generator-core</artifactId>
			<version>1.3.2</version>
		</dependency>
	</dependencies>
</plugin>

   

    src/main/resources/generatorConfig.properties

#Mybatis Generator configuration
#project = EKSP
#classPath=E:/workplace/EKSP/WebContent/WEB-INF/lib/ojdbc14.jar
#jdbc_driver = oracle.jdbc.driver.OracleDriver
#jdbc_url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
#jdbc_user=INFOGUARDIAN
#jdbc_password=info_idap132

project=/home/hok/workspace/xx-prj/src/main/java
classPath=/home/hok/.m2/repository/mysql/mysql-connector-java/5.1.25/mysql-connector-java-5.1.25.jar
jdbc_driver=com.mysql.jdbc.Driver
jdbc_url=jdbc:mysql://10.10.17.252:3306/test?useUnicode=true&amp;characterEncoding=UTF-8
jdbc_user=root
jdbc_password=123456
jdbc_schema=test

 

2、使用命令行

java -jar /home/hok/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.3.2/mybatis-generator-core-1.3.2.jar  -configfile generatorConfig.xml

 这时候generatorConfig.properties必须放到mybatis-generator-core-1.3.2.jar里

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics