No plugin found for prefix 'mybatis-generator' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\Maven Repository), nexus (http://10.0.20.242/nexus/content/groups/public/), alimaven (http://maven.aliyun.com/nexus/content/groups/public/)] -> [Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'mybatis-generator' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\Maven Repository), nexus (http://10.0.20.242/nexus/content/groups/public/), alimaven (http://mav
POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>gateway</artifactId>
<groupId>com.xinyan.person</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gateway-service</artifactId>
<dependencies>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.xinyan.person</groupId>
<artifactId>person-support</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
</dependency>
<dependency>
<groupId>com.xinyan.person</groupId>
<artifactId>gateway-micro</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.mandao.swagger</groupId>
<artifactId>mandao-swagger-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.32</version>
</dependency>
<!-- AMS -->
<dependency>
<groupId>com.baofu.ams</groupId>
<artifactId>ams-rest-api</artifactId>
<version>5.0.2</version>
</dependency>
<!-- DFS -->
<dependency>
<groupId>com.baofoo</groupId>
<artifactId>dfs-client</artifactId>
<version>2.0.7</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--CSV-->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form-spring</artifactId>
<version>2.1.0</version>
</dependency>
<!--mybatis自动生成代码-->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- 测试环境 -->
<id>DEV</id>
<properties>
<apollo.env>DEV</apollo.env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<!-- 生产环境 -->
<id>PRO</id>
<properties>
<apollo.env>PRO</apollo.env>
</properties>
</profile>
<!-- 准生产环境 -->
<profile>
<id>UAT</id>
<properties>
<apollo.env>PRO</apollo.env>
<apollo.idc>UAT</apollo.idc>
</properties>
</profile>
</profiles>
<build>
<finalName>gateway</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.json</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.4.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- mybatis-generator 代码自动生成 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
<!--配置属性-->
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>
</project>
generatorConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"
>
<generatorConfiguration>
<!-- 引入配置文件 -->
<!--<properties resource="application.properties"/>-->
<!--在MBG工作的时候,需要额外加载的依赖包,选择本地硬盘上面的数据库驱动包 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<classPathEntry location="D:/Maven Repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar"/>
<context id="context1" targetRuntime="MyBatis3" defaultModelType="flat">
<!-- 抑制警告 -->
<property name="suppressTypeWarnings" value="true"/>
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 格式化java代码 -->
<property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
<!-- 格式化XML代码 -->
<property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
<!-- beginningDelimiter和endingDelimiter:指明数据库的用于标记数据库对象名的符号,比如ORACLE就是双引号,MYSQL默认是`反引号 -->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- generate entity时,生成hashcode和equals方法 -->
<!-- <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin" /> -->
<!-- generate entity时,生成serialVersionUID -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<!-- 这个插件只会增加字符串字段映射到一个JDBC字符的方法 -->
<plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin"/>
<!-- genenat entity时,生成toString -->
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
<commentGenerator>
<!-- 是否去除自动生成的注释 如果生成日期,会造成即使修改一个字段,整个实体类所有属性都会发生变化,不利于版本控制,所以设置为true -->
<property name="suppressAllComments" value="true"/>
<!-- 阻止生成的注释包含时间戳,默认为false true:是 : false:否 -->
<property name="suppressDate" value="true"/>
</commentGenerator>
<!-- 数据库配置文件的url是不能直接拷贝过来用的,需要把&换成'&' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://10.0.20.108:3306/test?useUnicode=true&charaterEncoding=utf-8&allowMultiQueries=true&useSSL=false"
userId="baofoo"
password="mandao@64//">
</jdbcConnection>
<!-- java类型处理器
用于处理DB中的类型到Java中的类型,默认使用JavaTypeResolverDefaultImpl
注意一点,默认会先尝试使用Integer,Long,Short等来对应DECIMAL和 NUMERIC数据类型
-->
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<!-- true:使用BigDecimal对应DECIMAL和 NUMERIC数据类型
false:默认
scale>0;length>18:使用BigDecimal
scale=0;length[10,18]:使用Long
scale=0;length[5,9]:使用Integer
scale=0;length<5:使用Short
-->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成Entity实体的包名和位置 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<javaModelGenerator targetPackage="com.xinyan.person.gateway.data.base.entity"
targetProject="${project.build.directory}/../../demo/src/main/java">
<!--如果true,MBG会根据catalog和schema来生成子包。如果false就会直接用targetPackage属性。默认为false-->
<property name="enableSubPackages" value="true"/>
<!--是否对数据库查询结果进行trim操作-->
<property name="trimStrings" value="true"/>
<!--是否对xml追加,默认true,为了重新生成实体可以覆盖原文件改为false-->
<property name="isMergeable" value="false"/>
</javaModelGenerator>
<!-- 生成SQL映射文件的包名和位置 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<sqlMapGenerator targetPackage="com.xinyan.person.gateway.data.base.dao.impl"
targetProject="${project.build.directory}/../src/main/resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.xinyan.person.gateway.data.base.dao"
targetProject="${project.build.directory}/../src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 生成表名tableName 实体名domainObjectName ,schema用来防止重复生成sql.xml !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<!--schema查询语句 select table_schema FROM information_schema.tables WHERE table_name = 'test_user'; -->
<table schema="xy_person" tableName="T_H5_AUTH_PRODUCT" domainObjectName="H5AuthProduct"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
>
<!-- 默认为false,如果设置为true,在生成的SQL中,table名字不会加上catalog或schema -->
<property name="ignoreQualifiersAtRuntime" value="true"/>
<!--自动生成主键 数据库自增identity="true"-->
<generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>
<!--
该元素会在根据表中列名计算对象属性名之前先重命名列名,非常适合用于表中的列都有公用的前缀字符串的时候,
比如列名为:CUST_ID,CUST_NAME,CUST_EMAIL,CUST_ADDRESS等;
那么就可以设置searchString为"^CUST_",并使用空白替换,那么生成的Customer对象中的属性名称就不是
custId,custName等,而是先被替换为ID,NAME,EMAIL,然后变成属性:id,name,email;
注意,MBG是使用java.util.regex.Matcher.replaceAll来替换searchString和replaceString的,
如果使用了columnOverride元素,该属性无效;
-->
<!--<columnRenamingRule searchString="^CUST_" replaceString=""/>-->
</table>
<!--通配符 生成所有表-->
<!--<table tableName="%">-->
<!--</table>-->
</context>
</generatorConfiguration>
网上找了一大堆,别给我说clean, 现在是用mavn编译命令抛出的error,直接运行插件反而是下面这种,无法解为析任何表,也就是说没有生成任何代码
[INFO] --- mybatis-generator-maven-plugin:1.3.6:generate (default-cli) @ gateway-service ---
[INFO] Connecting to the Database
[INFO] Introspecting table xy_person.T_H5_AUTH_PRODUCT
[WARNING] Table configuration with catalog null, schema xy_person, and table T_H5_AUTH_PRODUCT did not resolve to any tables
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.879 s
[INFO] Finished at: 2018-09-11T09:19:51+08:00
[INFO] Final Memory: 30M/324M
[INFO] ------------------------------------------------------------------------