Skip to content

Commit

Permalink
解决找不到插件错误
Browse files Browse the repository at this point in the history
  • Loading branch information
silloy committed Mar 20, 2019
1 parent 33e69bb commit b33587d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ generatorConfig.xml增加
</plugin>
```

并通过Executor.java执行生成, 普通orm还是通过 `mvn mybatis-generator:generate -e -X` 执行
并通过Executor.java执行生成, 普通orm还是通过 `mvn mybatis-generator:generate -e -X` 执行

报错: [ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate (default-cli) on project mybatis-generator: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate failed: Cannot instantiate object of type me.silloy.plugins.LombokPlugin -> [Help 1]
解决:执行 `mvn package install`
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.hm</groupId>
<groupId>me.silloy</groupId>
<artifactId>mybatis-generator</artifactId>
<version>1.0-SNAPSHOT</version>

Expand Down Expand Up @@ -103,6 +103,16 @@
<artifactId>mapper</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<dependency>
<groupId>me.silloy</groupId>
<artifactId>mybatis-generator</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/silloy/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class Executor {
public static void main(String[] args) throws Exception {
List<String> warnings = new ArrayList<String>();
List<String> warnings = new ArrayList<>();
boolean overwrite = true;
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config =
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/generatorTKConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!--使用 Data 时,Getter,Setter 无效-->
<property name="lombok" value="Getter,Setter"/>
<property name="lombok" value="Getter,Setter,ToString,Accessors"/>
<!--<property name="swagger" value="true"/>-->
</plugin>

<!-- 使用自带序列化插件 -->
<!--<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>-->

<!-- 使用自定义的插件 -->
<plugin type="me.silloy.plugins.LombokPlugin">
<property name="builder" value="true"/>
<property name="allArgsConstructor" value="true"/>
Expand Down Expand Up @@ -68,9 +72,11 @@
<property name="useInformationSchema" value="true"/>
<property name="remarks" value="true"/>
</jdbcConnection>

<!--MyBatis 生成器只需要生成 Model-->
<javaModelGenerator targetPackage="${generator.basePackage}.domain" targetProject="src/main/java"/>


<table tableName="t_nav_button" domainObjectName="NavButton">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
Expand Down

0 comments on commit b33587d

Please sign in to comment.