From 64c82b76829b63aabb9a1a4ad341463fd9567d44 Mon Sep 17 00:00:00 2001 From: lsy <18332763730@163.com> Date: Wed, 6 Dec 2017 15:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/mojo/MybatisGeneratorExtendMojo.java | 3 +-- .../extend/service/MybatisGeneratorExtend.java | 2 -- .../fast/mybatis/generator/extend/util/JarUtil.java | 12 ++++++++++++ .../generator/extend/util/PropertiesUtil.java | 3 --- .../src/main/resources/mybatisStart.properties | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/mojo/MybatisGeneratorExtendMojo.java b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/mojo/MybatisGeneratorExtendMojo.java index 35f71da..def7b67 100644 --- a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/mojo/MybatisGeneratorExtendMojo.java +++ b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/mojo/MybatisGeneratorExtendMojo.java @@ -2,8 +2,6 @@ package com.micro.fast.mybatis.generator.extend.mojo; import com.micro.fast.mybatis.generator.extend.service.MybatisGeneratorExtend; -import com.micro.fast.mybatis.generator.extend.util.FreemarkerUtil; -import com.micro.fast.mybatis.generator.extend.util.JarUtil; import com.micro.fast.mybatis.generator.extend.util.PropertiesUtil; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -35,6 +33,7 @@ public class MybatisGeneratorExtendMojo extends AbstractMojo { } } } + //加载插件所需要的配置文件 new PropertiesUtil().loadProperties(projectPath); MybatisGeneratorExtend.GenerateMybatisGeneratorNeedFilesByTemplates(projectPath); } diff --git a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/service/MybatisGeneratorExtend.java b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/service/MybatisGeneratorExtend.java index d77f35e..5914d59 100644 --- a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/service/MybatisGeneratorExtend.java +++ b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/service/MybatisGeneratorExtend.java @@ -105,7 +105,5 @@ public class MybatisGeneratorExtend { } } - - } } diff --git a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/JarUtil.java b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/JarUtil.java index d68b3c3..56d3fc6 100644 --- a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/JarUtil.java +++ b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/JarUtil.java @@ -8,13 +8,25 @@ import java.util.jar.JarInputStream; public class JarUtil { + /** + * 获取当前jar的绝对路径 + * @return + */ public static String getThisJarPath(){ return JarUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath(); } + + /** + * 获取当前jar绝对路径的父路径 + * @return + */ public static String getThisJarPathParent(){ return new File(getThisJarPath()).getParent(); } + /** + * 解压当前jar中所需要的文件 + */ public static void unThisJar(){ JarInputStream jarInputStream = null; JarFile jarFile = null; diff --git a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/PropertiesUtil.java b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/PropertiesUtil.java index 7c4ddd1..84459f3 100644 --- a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/PropertiesUtil.java +++ b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/java/com/micro/fast/mybatis/generator/extend/util/PropertiesUtil.java @@ -6,9 +6,6 @@ import java.util.Properties; public class PropertiesUtil { private static final String PROPERTIES_PATH = "mybatisStart.properties"; private static Properties properties = null; - static { - - } /** * 根据key获取property的value diff --git a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/resources/mybatisStart.properties b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/resources/mybatisStart.properties index 225a4d2..9a513c7 100644 --- a/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/resources/mybatisStart.properties +++ b/boot-starter/boot-starter-maven-plugin/mybatis-generator-extend-maven-plugin/src/main/resources/mybatisStart.properties @@ -1,4 +1,4 @@ -#mybatisGeneratorExtend\u6240\u9700\u8981\u7684\u53C2\u6570 +#mybatisGeneratorExtend 所需要的必要的配置文件 db.driverLocation=/root/mysql-connector-java-5.1.40-bin.jar db.driverClassName=com.mysql.jdbc.Driver db.url=jdbc:mysql://172.17.0.1:3317/micro?useUncoide=true&chracterEncoding=utf-8&useSSL=false