You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ki...@apache.org on 2022/03/17 07:17:40 UTC

[incubator-seatunnel] branch dev updated: [doc] Add how to set up dev env (#1496)

This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 175b7b5  [doc] Add how to set up dev env (#1496)
175b7b5 is described below

commit 175b7b57fa4749c22575e96f325bc21d5dc19b46
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Thu Mar 17 15:14:17 2022 +0800

    [doc] Add how to set up dev env (#1496)
    
    Add all things developers should know about setting
    up the development environment. From software
    preparation to how to run examples
---
 docs/en/developement/setup.md | 87 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/docs/en/developement/setup.md b/docs/en/developement/setup.md
new file mode 100644
index 0000000..ed4601d
--- /dev/null
+++ b/docs/en/developement/setup.md
@@ -0,0 +1,87 @@
+# Set Up Environment and Run Simple Example
+
+In this section, we are going to show you how to set up your development environment for SeaTunnel, and then run a simple
+example in your JetBrains IntelliJ IDEA.
+
+> You can develop or test SeaTunnel code in any development environment that you like, but here we use
+> [JetBrains IDEA](https://www.jetbrains.com/idea/) as an example to teach you to step by step environment.
+
+## Prepare
+
+Before we start talking about how to set up the environment, we need to do some preparation work. Make sure you already
+have installed the following software:
+
+* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed.
+* [Java](https://www.java.com/en/download/) (only JDK 8 supported by now) installed and `JAVA_HOME` set.
+* [Scala](https://www.scala-lang.org/download/2.11.8.html) (only scala 2.11.8 supported by now) installed.
+* [Maven](https://maven.apache.org/download.cgi) installed.
+* [JetBrains IDEA](https://www.jetbrains.com/idea/) installed.
+
+## Set Up
+
+### Clone the Source Code
+
+First of all, you need to clone the SeaTunnel source code from [GitHub](https://github.com/apache/incubator-seatunnel).
+
+```shell
+git clone git@github.com:apache/incubator-seatunnel.git
+```
+
+### Install Subproject Locally
+
+After cloning the source code, you should run the `maven` command to install the subproject to the maven local repository.
+Otherwise, your code could not start in JetBrains IntelliJ IDEA correctly.
+
+```shell
+mvn install
+```
+
+### Install JetBrains IDEA Scala Plugin
+
+Now, you can open your JetBrains IntelliJ IDEA and explore the source code, but allow building Scala code in IDEA,
+you should also install JetBrains IntelliJ IDEA's [Scala plugin](https://plugins.jetbrains.com/plugin/1347-scala).
+See [install plugins for IDEA](https://www.jetbrains.com/help/idea/managing-plugins.html#install-plugins) if you want to.
+
+## Run Simple Example
+
+After all the above things are done, you just finish the environment setup and can run an example we provide to you out
+of box. All examples are in module `seatunnel-examples`, you could pick one you are interested in, [running or debugging
+it in IDEA](https://www.jetbrains.com/help/idea/run-debug-configuration.html) as you wish.
+
+Here we use `seatunnel-examples/seatunnel-flink-examples/src/main/java/org/apache/seatunnel/example/flink/LocalFlinkExample.java`
+as an example, when you run it successfully you could see the output as below:
+
+
+```log
++I[Gary, 1647423592505]
++I[Kid Xiong, 1647423593510]
++I[Ricky Huo, 1647423598537]
+...
+...
++I[Gary, 1647423597533]
+```
+
+## What's More
+
+All our examples use simple source and sink to make it less dependent and easy to run. You can change the example configuration
+in `resources/examples`. You could change your configuration as below, if you want to use PostgreSQL as the source and
+sink to console. 
+
+```conf
+env {
+  execution.parallelism = 1
+}
+
+source {
+  JdbcSource {
+    driver = org.postgresql.Driver
+    url = "jdbc:postgresql://host:port/database"
+    username = postgres
+    query = "select * from test"
+  }
+}
+
+sink {
+  ConsoleSink {}
+}
+```