[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
This commit is contained in:
parent
a50438f164
commit
0edce4c096
|
@ -9,11 +9,15 @@
|
||||||
<version>SNAPSHOT</version>
|
<version>SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.assembly.dir>src/main/resources/assembly</project.assembly.dir>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.taosdata.jdbc</groupId>
|
<groupId>com.taosdata.jdbc</groupId>
|
||||||
<artifactId>taos-jdbcdriver</artifactId>
|
<artifactId>taos-jdbcdriver</artifactId>
|
||||||
<version>2.0.22</version>
|
<version>2.0.30</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -22,20 +26,60 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.3.0</version>
|
||||||
<configuration>
|
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<mainClass>com.taosdata.example.JDBCDemo</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
|
<!-- jdbcDemo -->
|
||||||
<execution>
|
<execution>
|
||||||
<id>make-assembly</id>
|
<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>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>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>single</goal>
|
<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 jdbcDemo using mvn plugin
|
||||||
run command:
|
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
|
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
|
## Compile the Demo Code and Run It
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.taosdata.example;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class JDBCDemo {
|
public class JdbcDemo {
|
||||||
private static String host;
|
private static String host;
|
||||||
private static final String dbName = "test";
|
private static final String dbName = "test";
|
||||||
private static final String tbName = "weather";
|
private static final String tbName = "weather";
|
||||||
|
@ -17,7 +17,7 @@ public class JDBCDemo {
|
||||||
if (host == null) {
|
if (host == null) {
|
||||||
printHelp();
|
printHelp();
|
||||||
}
|
}
|
||||||
JDBCDemo demo = new JDBCDemo();
|
JdbcDemo demo = new JdbcDemo();
|
||||||
demo.init();
|
demo.init();
|
||||||
demo.createDatabase();
|
demo.createDatabase();
|
||||||
demo.useDatabase();
|
demo.useDatabase();
|
|
@ -4,7 +4,7 @@ import java.sql.*;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class JdbcRestfulDemo {
|
public class JdbcRestfulDemo {
|
||||||
private static final String host = "master";
|
private static final String host = "127.0.0.1";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue