Skip to content

Commit e0fad5d

Browse files
authored
maven wrapper provided (apache#377)
* readme update. * maven wrapper provided * streamx.sh provided more operations
1 parent 45f6c45 commit e0fad5d

File tree

12 files changed

+1281
-365
lines changed

12 files changed

+1281
-365
lines changed
+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
https://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
import java.io.File;
21+
import java.io.FileInputStream;
22+
import java.io.FileOutputStream;
23+
import java.io.IOException;
24+
import java.net.URL;
25+
import java.nio.channels.Channels;
26+
import java.nio.channels.ReadableByteChannel;
27+
import java.util.Properties;
28+
29+
public class MavenWrapperDownloader {
30+
31+
/**
32+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
33+
*/
34+
private static final String DEFAULT_DOWNLOAD_URL =
35+
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
36+
37+
/**
38+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
39+
* use instead of the default one.
40+
*/
41+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
42+
".mvn/wrapper/maven-wrapper.properties";
43+
44+
/**
45+
* Path where the maven-wrapper.jar will be saved to.
46+
*/
47+
private static final String MAVEN_WRAPPER_JAR_PATH =
48+
".mvn/wrapper/maven-wrapper.jar";
49+
50+
/**
51+
* Name of the property which should be used to override the default download url for the wrapper.
52+
*/
53+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
54+
55+
public static void main(String args[]) {
56+
System.out.println("- Downloader started");
57+
File baseDirectory = new File(args[0]);
58+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
59+
60+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
61+
// wrapperUrl parameter.
62+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
63+
String url = DEFAULT_DOWNLOAD_URL;
64+
if (mavenWrapperPropertyFile.exists()) {
65+
FileInputStream mavenWrapperPropertyFileInputStream = null;
66+
try {
67+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
68+
Properties mavenWrapperProperties = new Properties();
69+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
70+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
71+
} catch (IOException e) {
72+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
73+
} finally {
74+
try {
75+
if (mavenWrapperPropertyFileInputStream != null) {
76+
mavenWrapperPropertyFileInputStream.close();
77+
}
78+
} catch (IOException e) {
79+
// Ignore ...
80+
}
81+
}
82+
}
83+
System.out.println("- Downloading from: : " + url);
84+
85+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
86+
if (!outputFile.getParentFile().exists()) {
87+
if (!outputFile.getParentFile().mkdirs()) {
88+
System.out.println(
89+
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
90+
}
91+
}
92+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
93+
try {
94+
downloadFileFromURL(url, outputFile);
95+
System.out.println("Done");
96+
System.exit(0);
97+
} catch (Throwable e) {
98+
System.out.println("- Error downloading");
99+
e.printStackTrace();
100+
System.exit(1);
101+
}
102+
}
103+
104+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
105+
URL website = new URL(urlString);
106+
ReadableByteChannel rbc;
107+
rbc = Channels.newChannel(website.openStream());
108+
FileOutputStream fos = new FileOutputStream(destination);
109+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
110+
fos.close();
111+
rbc.close();
112+
}
113+
114+
}

.mvn/wrapper/maven-wrapper.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip

README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ data laker.
5454
* Out-of-the-box connectors
5555
* Support maven compilation
5656
* Configuration
57+
* Multi version flick support(1.12.x,1.13.x,1.14.x)
58+
* Kubernetes deployment (k8s-native-session,k8s-application)
5759
* Support `Applicaion` and `Yarn-Per-Job` mode
5860
* `start`, `stop`, `savepoint`, resume from `savepoint`
5961
* Flame graph
@@ -118,8 +120,8 @@ early inspiration and help.
118120

119121
```
120122
git clone https://github.com/streamxhub/streamx.git
121-
cd Streamx
122-
mvn clean install -DskipTests -Denv=prod
123+
cd streamx
124+
./mvnw clean install -DskipTests -Denv=prod
123125
```
124126

125127
click [Document](http://www.streamxhub.com/zh/doc/) for more information
@@ -144,15 +146,19 @@ in DTStack, which realizes efficient data migration between multiple heterogeneo
144146
`StreamX` focuses on the management of development phases and tasks. The `streamx-pump` module is also under planning, dedicated to solving
145147
data source migration, and will eventually be integrated into the `streamx-console`.
146148

147-
## 🍼 Feedback
148149

149-
You can quickly submit an issue. Before submitting, please check the problem and try to use the following contact information! Maybe your
150-
question has already been asked by others, or it has already been answered. Thank you!
150+
## 🤝 Contributing
151151

152-
You can contact us or ask questions via:
152+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/streamxhub/streamx/pulls)
153+
154+
You can submit any ideas as [pull requests](https://github.com/streamxhub/streamx/pulls) or as [GitHub issues](https://github.com/streamxhub/streamx/issues/new/choose).
155+
156+
> If you're new to posting issues, we ask that you read [*How To Ask Questions The Smart Way*](http://www.catb.org/~esr/faqs/smart-questions.html) (**This guide does not provide actual support services for this project!**), [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) prior to posting. Well written bug reports help us help you!
157+
158+
Thanks to [JetBrains](https://www.jetbrains.com/?from=streamx) for supporting us free open source licenses.
159+
160+
[![JetBrains](https://img.alicdn.com/tfs/TB1sSomo.z1gK0jSZLeXXb9kVXa-120-130.svg)](https://www.jetbrains.com/?from=streamx)
153161

154-
- [New an issue](https://github.com/streamxhub/streamx/issues/new)
155-
- [Join us](#-Join-us)
156162

157163
## 💰 Donation
158164

@@ -174,13 +180,15 @@ Welcome individuals and enterprises to sponsor, your support will help us better
174180

175181
<p>
176182
<a href="https://github.com/wolfboys" alt="benjobs"><img src="https://avatars.githubusercontent.com/u/13284744?v=4" height="50" width="50"></a>
183+
<a href="https://github.com/Kitming25" alt="Kitming25"><img src="https://avatars.githubusercontent.com/u/11773106?v=4" height="50" width="50"></a>
177184
<a href="https://github.com/Narcasserun" alt="Narcasserun"><img src="https://avatars.githubusercontent.com/u/39329477?v=4" height="50" width="50"></a>
178185
</p>
179186

180187
### 🥈 Platinum Supplier
181188

182189
<p>
183190
<a href="https://github.com/lianxiaobao" alt="lianxiaobao"><img src="https://avatars.githubusercontent.com/u/36557317?v=4" height="50" width="50"></a>
191+
<a href="https://github.com/su94998" alt="su94998"><img src="https://avatars.githubusercontent.com/u/33316193?v=4" height="50" width="50"></a>
184192
</p>
185193

186194
### 🥈 Silver Supplier

README_CN.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
</div>
3030

31-
[English](README.md) | 中文
31+
##[English](README.md) | 中文
3232

3333
# StreamX
3434

@@ -56,6 +56,8 @@ Make Flink|Spark easier!!!
5656
* 一系列开箱即用的connectors
5757
* 支持项目编译功能(maven 编译)
5858
* 在线参数配置
59+
* 多版本flink支持(1.12.x,1.13.x,1.14.x)
60+
* Kubernetes部署支持(k8s-native-session,k8s-application)
5961
* 支持 `Applicaion` 模式, `Yarn-Per-Job` 模式启动
6062
* 快捷的日常操作(任务`启动``停止``savepoint`,从`savepoint`恢复)
6163
* 支持火焰图
@@ -114,7 +116,7 @@ Make Flink|Spark easier!!!
114116

115117
```
116118
git clone https://github.com/streamxhub/streamx.git
117-
cd Streamx
119+
cd streamx
118120
mvn clean install -DskipTests -Denv=prod
119121
```
120122

@@ -138,14 +140,18 @@ mvn clean install -DskipTests -Denv=prod
138140
是基于flink的分布式数据同步工具,实现了多种异构数据源之间高效的数据迁移,定位比较明确,专门用来做数据抽取和迁移,可以作为一个服务组件来使用,`StreamX` 关注开发阶段和任务后期的管理,定位有所不同,`streamx-pump`
139141
模块也在规划中, 致力于解决数据源抽取和迁移,最终会集成到 `streamx-console`
140142

141-
## 🍼 Feedback
142143

143-
你可以快速的提一个[ISSUES](https://github.com/streamxhub/streamx/issues) ,在提之前,请检查问题后再尝试使用以下联系方式!也许你的问题已经被别人问到了,或者已经被回答了。谢谢!
144+
## 🤝 如何贡献
144145

145-
您可以通过以下方法向我提供反馈或问题:
146+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/streamxhub/streamx/pulls)
146147

147-
- [快速创建issue!](https://github.com/streamxhub/streamx/issues/new)
148-
- [加入社区](#-加入社区)
148+
如果你希望参与贡献 欢迎 [Pull Request](https://github.com/streamxhub/streamx/pulls),或给我们 [报告 Bug](https://github.com/streamxhub/streamx/issues/new/choose)
149+
150+
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)(**本指南不提供此项目的实际支持服务!**)、[《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
151+
152+
感谢 [JetBrains](https://www.jetbrains.com/?from=streamx) 提供的免费开源 License 赞助
153+
154+
[![JetBrains](https://img.alicdn.com/tfs/TB1sSomo.z1gK0jSZLeXXb9kVXa-120-130.svg)](https://www.jetbrains.com/?from=streamx)
149155

150156
## 💰 Donation
151157

@@ -170,13 +176,15 @@ StreamX现在离这个目标还有一段距离,还需持续投入,相应的
170176

171177
<p>
172178
<a href="https://github.com/wolfboys" alt="benjobs"><img src="https://avatars.githubusercontent.com/u/13284744?v=4" height="50" width="50"></a>
179+
<a href="https://github.com/Kitming25" alt="Kitming25"><img src="https://avatars.githubusercontent.com/u/11773106?v=4" height="50" width="50"></a>
173180
<a href="https://github.com/Narcasserun" alt="Narcasserun"><img src="https://avatars.githubusercontent.com/u/39329477?v=4" height="50" width="50"></a>
174181
</p>
175182

176183
### 🥈 白金赞助商
177184

178185
<p>
179186
<a href="https://github.com/lianxiaobao" alt="lianxiaobao"><img src="https://avatars.githubusercontent.com/u/36557317?v=4" height="50" width="50"></a>
187+
<a href="https://github.com/su94998" alt="su94998"><img src="https://avatars.githubusercontent.com/u/33316193?v=4" height="50" width="50"></a>
180188
</p>
181189

182190
### 🥈 白银赞助商

0 commit comments

Comments
 (0)