Skip to content

Commit 9b21161

Browse files
authored
Merge pull request #992 from zhicwu/develop
Clean up pom files and fix HttpClient issues
2 parents 4be83e5 + 52de029 commit 9b21161

File tree

17 files changed

+384
-215
lines changed

17 files changed

+384
-215
lines changed

clickhouse-benchmark/pom.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
</parent>
99

1010
<artifactId>clickhouse-benchmark</artifactId>
11-
<version>${revision}</version>
1211
<packaging>jar</packaging>
1312

14-
<name>${project.artifactId}</name>
13+
<name>ClickHouse Client Benchmarks</name>
1514
<description>Benchmarks for ClickHouse clients</description>
1615
<url>https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-benchmark</url>
1716

clickhouse-cli-client/pom.xml

+41-24
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,21 @@
88
</parent>
99

1010
<artifactId>clickhouse-cli-client</artifactId>
11-
<version>${revision}</version>
1211
<packaging>jar</packaging>
1312

14-
<name>${project.artifactId}</name>
13+
<name>ClickHouse Native Command-line Wrapper</name>
1514
<description>Wrapper of ClickHouse native command-line client</description>
1615
<url>https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-cli-client</url>
1716

18-
<properties>
19-
<shade.base>${project.parent.groupId}.client.internal</shade.base>
20-
</properties>
21-
2217
<dependencies>
2318
<dependency>
2419
<groupId>${project.parent.groupId}</groupId>
2520
<artifactId>clickhouse-client</artifactId>
2621
<version>${revision}</version>
27-
<exclusions>
28-
<exclusion>
29-
<groupId>*</groupId>
30-
<artifactId>*</artifactId>
31-
</exclusion>
32-
</exclusions>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.lz4</groupId>
25+
<artifactId>lz4-java</artifactId>
3326
</dependency>
3427

3528
<!-- necessary for Java 9+ -->
@@ -65,6 +58,19 @@
6558

6659
<build>
6760
<plugins>
61+
<plugin>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-compiler-plugin</artifactId>
64+
</plugin>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-failsafe-plugin</artifactId>
68+
<configuration>
69+
<environmentVariables>
70+
<CHC_TEST_CONTAINER_ID>clickhouse-cli-client</CHC_TEST_CONTAINER_ID>
71+
</environmentVariables>
72+
</configuration>
73+
</plugin>
6874
<plugin>
6975
<groupId>org.apache.maven.plugins</groupId>
7076
<artifactId>maven-shade-plugin</artifactId>
@@ -77,13 +83,24 @@
7783
</goals>
7884
<configuration>
7985
<shadedArtifactAttached>true</shadedArtifactAttached>
86+
<shadedClassifierName>shaded</shadedClassifierName>
8087
<createDependencyReducedPom>true</createDependencyReducedPom>
8188
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
82-
<shadedClassifierName>shaded</shadedClassifierName>
89+
<relocations>
90+
<relocation>
91+
<pattern>net.jpountz</pattern>
92+
<shadedPattern>${shade.base}.jpountz</shadedPattern>
93+
</relocation>
94+
</relocations>
8395
<transformers>
8496
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
8597
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" />
8698
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
99+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
100+
<manifestEntries>
101+
<Automatic-Module-Name>com.clickhouse.client.cli</Automatic-Module-Name>
102+
</manifestEntries>
103+
</transformer>
87104
</transformers>
88105
<filters>
89106
<filter>
@@ -104,17 +121,17 @@
104121
</executions>
105122
</plugin>
106123
<plugin>
107-
<groupId>org.apache.maven.plugins</groupId>
108-
<artifactId>maven-compiler-plugin</artifactId>
109-
</plugin>
110-
<plugin>
111-
<groupId>org.apache.maven.plugins</groupId>
112-
<artifactId>maven-failsafe-plugin</artifactId>
113-
<configuration>
114-
<environmentVariables>
115-
<CHC_TEST_CONTAINER_ID>clickhouse-cli-client</CHC_TEST_CONTAINER_ID>
116-
</environmentVariables>
117-
</configuration>
124+
<groupId>org.codehaus.mojo</groupId>
125+
<artifactId>flatten-maven-plugin</artifactId>
126+
<executions>
127+
<execution>
128+
<id>flatten</id>
129+
<phase>package</phase>
130+
<goals>
131+
<goal>flatten</goal>
132+
</goals>
133+
</execution>
134+
</executions>
118135
</plugin>
119136
</plugins>
120137
</build>

clickhouse-client/pom.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
</parent>
99

1010
<artifactId>clickhouse-client</artifactId>
11-
<version>${revision}</version>
1211
<packaging>jar</packaging>
1312

14-
<name>${project.artifactId}</name>
13+
<name>ClickHouse Java Client</name>
1514
<description>Unified Java client for ClickHouse</description>
1615
<url>https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-client</url>
1716

clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseInputStream.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ public abstract class ClickHouseInputStream extends InputStream {
7575
* @param compressionLevel compression level
7676
* @return non-null wrapped input stream
7777
*/
78-
static ClickHouseInputStream wrap(ClickHouseFile file, InputStream input, int bufferSize, Runnable postCloseAction,
79-
ClickHouseCompression compression, int compressionLevel) {
78+
public static ClickHouseInputStream wrap(ClickHouseFile file, InputStream input, int bufferSize,
79+
Runnable postCloseAction, ClickHouseCompression compression, int compressionLevel) {
8080
final ClickHouseInputStream chInput;
8181
if (compression == null || compression == ClickHouseCompression.NONE) {
82-
chInput = new WrappedInputStream(file, input, bufferSize, postCloseAction);
82+
chInput = input != EmptyInputStream.INSTANCE && input instanceof ClickHouseInputStream
83+
? (ClickHouseInputStream) input
84+
: new WrappedInputStream(file, input, bufferSize, postCloseAction);
8385
} else {
8486
switch (compression) {
8587
case GZIP:
@@ -485,7 +487,7 @@ public static File save(File file, InputStream in, int bufferSize, int timeout,
485487
tmp = File.createTempFile("chc", "data");
486488
tmp.deleteOnExit();
487489
} catch (IOException e) {
488-
throw new IllegalStateException("Failed to create temp file", e);
490+
throw new UncheckedIOException("Failed to create temp file", e);
489491
}
490492
}
491493
CompletableFuture<File> data = CompletableFuture.supplyAsync(() -> {
@@ -509,7 +511,9 @@ public static File save(File file, InputStream in, int bufferSize, int timeout,
509511
} catch (ExecutionException e) {
510512
Throwable cause = e.getCause();
511513
if (cause instanceof UncheckedIOException) {
512-
cause = ((UncheckedIOException) cause).getCause();
514+
throw ((UncheckedIOException) cause);
515+
} else if (cause instanceof IOException) {
516+
throw new UncheckedIOException((IOException) cause);
513517
}
514518
throw new IllegalStateException(cause);
515519
}

clickhouse-grpc-client/pom.xml

+60-16
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88
</parent>
99

1010
<artifactId>clickhouse-grpc-client</artifactId>
11-
<version>${revision}</version>
1211
<packaging>jar</packaging>
1312

14-
<name>${project.artifactId}</name>
13+
<name>ClickHouse gRPC Client</name>
1514
<description>gRPC client for ClickHouse</description>
1615
<url>https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-grpc-client</url>
1716

18-
<properties>
19-
<shade.base>${project.parent.groupId}.client.internal</shade.base>
20-
</properties>
21-
2217
<dependencies>
2318
<dependency>
2419
<groupId>${project.parent.groupId}</groupId>
@@ -35,20 +30,24 @@
3530
</exclusion>
3631
</exclusions>
3732
</dependency>
33+
<dependency>
34+
<groupId>org.lz4</groupId>
35+
<artifactId>lz4-java</artifactId>
36+
</dependency>
3837

3938
<dependency>
4039
<groupId>com.google.code.gson</groupId>
4140
<artifactId>gson</artifactId>
4241
</dependency>
42+
<dependency>
43+
<groupId>org.apache.commons</groupId>
44+
<artifactId>commons-compress</artifactId>
45+
</dependency>
4346
<dependency>
4447
<groupId>io.grpc</groupId>
4548
<artifactId>grpc-protobuf</artifactId>
4649
<scope>provided</scope>
4750
</dependency>
48-
<dependency>
49-
<groupId>org.apache.commons</groupId>
50-
<artifactId>commons-compress</artifactId>
51-
</dependency>
5251
<!-- necessary for Java 9+ -->
5352
<dependency>
5453
<groupId>org.apache.tomcat</groupId>
@@ -88,6 +87,10 @@
8887
</extension>
8988
</extensions>
9089
<plugins>
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-compiler-plugin</artifactId>
93+
</plugin>
9194
<plugin>
9295
<groupId>org.apache.maven.plugins</groupId>
9396
<artifactId>maven-shade-plugin</artifactId>
@@ -100,9 +103,9 @@
100103
</goals>
101104
<configuration>
102105
<shadedArtifactAttached>true</shadedArtifactAttached>
106+
<shadedClassifierName>shaded</shadedClassifierName>
103107
<createDependencyReducedPom>true</createDependencyReducedPom>
104108
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
105-
<shadedClassifierName>shaded</shadedClassifierName>
106109
<relocations>
107110
<relocation>
108111
<pattern>com.google</pattern>
@@ -116,6 +119,10 @@
116119
<pattern>okio</pattern>
117120
<shadedPattern>${shade.base}.okio</shadedPattern>
118121
</relocation>
122+
<relocation>
123+
<pattern>org.apache</pattern>
124+
<shadedPattern>${shade.base}.apache</shadedPattern>
125+
</relocation>
119126
<relocation>
120127
<pattern>io.grpc</pattern>
121128
<shadedPattern>${shade.base}.grpc</shadedPattern>
@@ -128,11 +135,20 @@
128135
<pattern>io.opencensus</pattern>
129136
<shadedPattern>${shade.base}.opencensus</shadedPattern>
130137
</relocation>
138+
<relocation>
139+
<pattern>net.jpountz</pattern>
140+
<shadedPattern>${shade.base}.jpountz</shadedPattern>
141+
</relocation>
131142
</relocations>
132143
<transformers>
133144
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
134145
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" />
135146
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
147+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
148+
<manifestEntries>
149+
<Automatic-Module-Name>com.clickhouse.client.grpc</Automatic-Module-Name>
150+
</manifestEntries>
151+
</transformer>
136152
</transformers>
137153
<filters>
138154
<filter>
@@ -141,7 +157,8 @@
141157
<exclude>android/**</exclude>
142158
<exclude>google/**</exclude>
143159
<exclude>javax/**</exclude>
144-
<exclude>org/**</exclude>
160+
<exclude>org/checkerframework/**</exclude>
161+
<exclude>org/codehaus/**</exclude>
145162
<exclude>**/module-info.class</exclude>
146163
<exclude>META-INF/MANIFEST.MF</exclude>
147164
<exclude>META-INF/maven/**</exclude>
@@ -167,6 +184,10 @@
167184
<pattern>com.google</pattern>
168185
<shadedPattern>${shade.base}.google</shadedPattern>
169186
</relocation>
187+
<relocation>
188+
<pattern>org.apache</pattern>
189+
<shadedPattern>${shade.base}.apache</shadedPattern>
190+
</relocation>
170191
<relocation>
171192
<pattern>io.grpc</pattern>
172193
<shadedPattern>${shade.base}.grpc</shadedPattern>
@@ -179,6 +200,10 @@
179200
<pattern>io.opencensus</pattern>
180201
<shadedPattern>${shade.base}.opencensus</shadedPattern>
181202
</relocation>
203+
<relocation>
204+
<pattern>net.jpountz</pattern>
205+
<shadedPattern>${shade.base}.jpountz</shadedPattern>
206+
</relocation>
182207
</relocations>
183208
<transformers>
184209
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
@@ -195,7 +220,8 @@
195220
<exclude>io/grpc/okhttp/**</exclude>
196221
<exclude>javax/**</exclude>
197222
<exclude>okio/**</exclude>
198-
<exclude>org/**</exclude>
223+
<exclude>org/checkerframework/**</exclude>
224+
<exclude>org/codehaus/**</exclude>
199225
<exclude>**/module-info.class</exclude>
200226
<exclude>META-INF/MANIFEST.MF</exclude>
201227
<exclude>META-INF/maven/**</exclude>
@@ -229,6 +255,10 @@
229255
<pattern>okio</pattern>
230256
<shadedPattern>${shade.base}.okio</shadedPattern>
231257
</relocation>
258+
<relocation>
259+
<pattern>org.apache</pattern>
260+
<shadedPattern>${shade.base}.apache</shadedPattern>
261+
</relocation>
232262
<relocation>
233263
<pattern>io.grpc</pattern>
234264
<shadedPattern>${shade.base}.grpc</shadedPattern>
@@ -241,6 +271,10 @@
241271
<pattern>io.opencensus</pattern>
242272
<shadedPattern>${shade.base}.opencensus</shadedPattern>
243273
</relocation>
274+
<relocation>
275+
<pattern>net.jpountz</pattern>
276+
<shadedPattern>${shade.base}.jpountz</shadedPattern>
277+
</relocation>
244278
</relocations>
245279
<transformers>
246280
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
@@ -255,7 +289,8 @@
255289
<exclude>google/**</exclude>
256290
<exclude>io/grpc/netty/**</exclude>
257291
<exclude>javax/**</exclude>
258-
<exclude>org/**</exclude>
292+
<exclude>org/checkerframework/**</exclude>
293+
<exclude>org/codehaus/**</exclude>
259294
<exclude>**/module-info.class</exclude>
260295
<exclude>META-INF/MANIFEST.MF</exclude>
261296
<exclude>META-INF/maven/**</exclude>
@@ -288,8 +323,17 @@
288323
</executions>
289324
</plugin>
290325
<plugin>
291-
<groupId>org.apache.maven.plugins</groupId>
292-
<artifactId>maven-compiler-plugin</artifactId>
326+
<groupId>org.codehaus.mojo</groupId>
327+
<artifactId>flatten-maven-plugin</artifactId>
328+
<executions>
329+
<execution>
330+
<id>flatten</id>
331+
<phase>package</phase>
332+
<goals>
333+
<goal>flatten</goal>
334+
</goals>
335+
</execution>
336+
</executions>
293337
</plugin>
294338
<plugin>
295339
<groupId>org.xolstice.maven.plugins</groupId>

0 commit comments

Comments
 (0)