未验证 提交 0edce4c0 编写于 作者: Z Zhiyu Yang 提交者: GitHub

[TD-4762]<feature>: use maven-assembly-plugins to package multi packages for jdbc demo (#6539)

* [TD-4762]<feature>: use maven-assembly-plugin package multi package for this demo

* change
上级 a50438f1
......@@ -9,11 +9,15 @@
<version>SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.assembly.dir>src/main/resources/assembly</project.assembly.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.22</version>
<version>2.0.30</version>
</dependency>
</dependencies>
......@@ -22,20 +26,60 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.taosdata.example.JDBCDemo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<version>3.3.0</version>
<executions>
<!-- jdbcDemo -->
<execution>
<id>JdbcDemo</id>
<configuration>
<finalName>JdbcDemo</finalName>
<archive>
<manifest>
<mainClass>com.taosdata.example.JdbcDemo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>JdbcRestfulDemo</id>
<configuration>
<finalName>JdbcRestfulDemo</finalName>
<archive>
<manifest>
<mainClass>com.taosdata.example.JdbcRestfulDemo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>make-assembly</id>
<id>SubscribeDemo</id>
<configuration>
<finalName>SubscribeDemo</finalName>
<archive>
<manifest>
<mainClass>com.taosdata.example.SubscribeDemo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
......
......@@ -11,12 +11,12 @@ Download the tdengine package on our website: ``https://www.taosdata.com/cn/all-
## Run jdbcDemo using mvn plugin
run command:
```
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo"
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JdbcDemo"
```
and run with your customed args
```
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo" -Dexec.args="-host [HOSTNAME]"
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JdbcDemo" -Dexec.args="-host [HOSTNAME]"
```
## Compile the Demo Code and Run It
......
......@@ -3,7 +3,7 @@ package com.taosdata.example;
import java.sql.*;
import java.util.Properties;
public class JDBCDemo {
public class JdbcDemo {
private static String host;
private static final String dbName = "test";
private static final String tbName = "weather";
......@@ -17,7 +17,7 @@ public class JDBCDemo {
if (host == null) {
printHelp();
}
JDBCDemo demo = new JDBCDemo();
JdbcDemo demo = new JdbcDemo();
demo.init();
demo.createDatabase();
demo.useDatabase();
......
......@@ -4,7 +4,7 @@ import java.sql.*;
import java.util.Properties;
public class JdbcRestfulDemo {
private static final String host = "master";
private static final String host = "127.0.0.1";
public static void main(String[] args) {
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册