From 0f95d92adfd62a6d01678cdd53a1b436bc1ef3ce Mon Sep 17 00:00:00 2001 From: xiongchun <18616786188@qq.com> Date: Mon, 20 Sep 2021 15:06:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Emaven=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pangu-framework-builder-maven-plugin/pom.xml | 31 ++++++++++++++++- .../framework/builder/PanGuBuilderMojo.java | 34 ++++++++++++++----- .../{plugin.properties => about.properties} | 0 pangu-framework-parent/pom.xml | 13 +++++++ 4 files changed, 69 insertions(+), 9 deletions(-) rename pangu-framework-builder-maven-plugin/src/main/resources/{plugin.properties => about.properties} (100%) diff --git a/pangu-framework-builder-maven-plugin/pom.xml b/pangu-framework-builder-maven-plugin/pom.xml index 4d91195fb..2d682c342 100644 --- a/pangu-framework-builder-maven-plugin/pom.xml +++ b/pangu-framework-builder-maven-plugin/pom.xml @@ -37,8 +37,9 @@ UTF-8 UTF-8 1.8 - 5.7.11 + 5.7.13 1.18.20 + 8.0.26 3.8.2 3.6.1 3.5.2 @@ -65,6 +66,22 @@ hutool-all ${hutool-all.version} + + mysql + mysql-connector-java + ${mysql-connector-java.version} + + + protobuf-java + com.google.protobuf + + + + + commons-dbutils + commons-dbutils + 1.7 + org.projectlombok lombok @@ -113,6 +130,18 @@ + + default + + + aliyun + https://maven.aliyun.com/repository/public + + + + true + + release diff --git a/pangu-framework-builder-maven-plugin/src/main/java/com/gitee/pulanos/pangu/framework/builder/PanGuBuilderMojo.java b/pangu-framework-builder-maven-plugin/src/main/java/com/gitee/pulanos/pangu/framework/builder/PanGuBuilderMojo.java index bfccdac42..8cb55c541 100644 --- a/pangu-framework-builder-maven-plugin/src/main/java/com/gitee/pulanos/pangu/framework/builder/PanGuBuilderMojo.java +++ b/pangu-framework-builder-maven-plugin/src/main/java/com/gitee/pulanos/pangu/framework/builder/PanGuBuilderMojo.java @@ -1,25 +1,43 @@ package com.gitee.pulanos.pangu.framework.builder; +import cn.hutool.json.JSONUtil; +import lombok.SneakyThrows; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.MapListHandler; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import java.sql.Connection; +import java.sql.DriverManager; +import java.util.List; +import java.util.Map; + /** - * maven插件入口 + * 插件入口 * * @author xiongchun */ @Mojo(name = "builder") public class PanGuBuilderMojo extends AbstractMojo { - @Parameter(property = "driverName") - private String driverName; + @Parameter(property = "url") + private String url; + @Parameter(property = "user") + private String user; + @Parameter(property = "password") + private String password; + @SneakyThrows @Override - public void execute() throws MojoExecutionException, MojoFailureException { - System.out.println(driverName); + public void execute() { + Connection conn = DriverManager.getConnection(url, user, password); + QueryRunner run = new QueryRunner(); + List> result = run.query(conn, + "SELECT * FROM user WHERE name = ?", new MapListHandler(), "XC"); + System.out.println(JSONUtil.toJsonStr(result)); + DbUtils.closeQuietly(conn); } + } diff --git a/pangu-framework-builder-maven-plugin/src/main/resources/plugin.properties b/pangu-framework-builder-maven-plugin/src/main/resources/about.properties similarity index 100% rename from pangu-framework-builder-maven-plugin/src/main/resources/plugin.properties rename to pangu-framework-builder-maven-plugin/src/main/resources/about.properties diff --git a/pangu-framework-parent/pom.xml b/pangu-framework-parent/pom.xml index e0912b07a..460339a8a 100644 --- a/pangu-framework-parent/pom.xml +++ b/pangu-framework-parent/pom.xml @@ -199,6 +199,19 @@ + + default + + + aliyun + https://maven.aliyun.com/repository/public + + + + true + + + release -- GitLab