You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/03/15 00:09:39 UTC

[GitHub] [beam] pcoet commented on a change in pull request #17033: BEAM-12770: Documented maven-to-gradle conversion for Dataflow

pcoet commented on a change in pull request #17033:
URL: https://github.com/apache/beam/pull/17033#discussion_r826476030



##########
File path: website/www/site/content/en/get-started/quickstart-java.md
##########
@@ -19,462 +19,376 @@ See the License for the specific language governing permissions and
 limitations under the License.
 -->
 
-# Apache Beam Java SDK Quickstart
+# Apache Beam Java SDK quickstart
 
-This quickstart shows you how to set up a Java development environment and run an [example pipeline](/get-started/wordcount-example) written with the [Apache Beam Java SDK](/documentation/sdks/java), using a [runner](/documentation#runners) of your choice.
+This quickstart shows you how to set up a Java development environment and run
+an [example pipeline](/get-started/wordcount-example) written with the
+[Apache Beam Java SDK](/documentation/sdks/java), using a
+[runner](/documentation#runners) of your choice.
 
-If you're interested in contributing to the Apache Beam Java codebase, see the [Contribution Guide](/contribute).
+If you're interested in contributing to the Apache Beam Java codebase, see the
+[Contribution Guide](/contribute).
 
-{{< toc >}}
+On this page:
 
-## Set up your Development Environment
-
-1. Download and install the [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/index.html) version 8. Verify that the [JAVA_HOME](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars001.html) environment variable is set and points to your JDK installation.
-
-1. Download and install [Apache Maven](https://maven.apache.org/download.cgi) by following Maven's [installation guide](https://maven.apache.org/install.html) for your specific operating system.
-
-1. Optional: Install [Gradle](https://gradle.org/install/) if you would like to convert your Maven project into Gradle.
-
-## Get the Example Code
-
-Use the following command to generate a Maven project that contains Beam's WordCount examples and builds against the most recent Beam release:
-
-{{< shell unix >}}
-$ mvn archetype:generate \
-      -DarchetypeGroupId=org.apache.beam \
-      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
-      -DarchetypeVersion={{< param release_latest >}} \
-      -DgroupId=org.example \
-      -DartifactId=word-count-beam \
-      -Dversion="0.1" \
-      -Dpackage=org.apache.beam.examples \
-      -DinteractiveMode=false
-{{< /shell >}}
-
-{{< shell powerShell >}}
-PS> mvn archetype:generate `
- -D archetypeGroupId=org.apache.beam `
- -D archetypeArtifactId=beam-sdks-java-maven-archetypes-examples `
- -D archetypeVersion={{< param release_latest >}} `
- -D groupId=org.example `
- -D artifactId=word-count-beam `
- -D version="0.1" `
- -D package=org.apache.beam.examples `
- -D interactiveMode=false
-{{< /shell >}}
-
-This will create a `word-count-beam` directory that contains a `pom.xml` and several example pipelines that count words in text files.
-
-{{< shell unix >}}
-$ cd word-count-beam/
-
-$ ls
-pom.xml	src
-
-$ ls src/main/java/org/apache/beam/examples/
-DebuggingWordCount.java	WindowedWordCount.java	common
-MinimalWordCount.java	WordCount.java
-{{< /shell >}}
-
-{{< shell powerShell >}}
-PS> cd .\word-count-beam
-
-PS> dir
-
-...
-
-Mode                LastWriteTime         Length Name
-----                -------------         ------ ----
-d-----        7/19/2018  11:00 PM                src
--a----        7/19/2018  11:00 PM          16051 pom.xml
-
-PS> dir .\src\main\java\org\apache\beam\examples
-
-...
-Mode                LastWriteTime         Length Name
-----                -------------         ------ ----
-d-----        7/19/2018  11:00 PM                common
-d-----        7/19/2018  11:00 PM                complete
-d-----        7/19/2018  11:00 PM                subprocess
--a----        7/19/2018  11:00 PM           7073 DebuggingWordCount.java
--a----        7/19/2018  11:00 PM           5945 MinimalWordCount.java
--a----        7/19/2018  11:00 PM           9490 WindowedWordCount.java
--a----        7/19/2018  11:00 PM           7662 WordCount.java
-{{< /shell >}}
-
-For a detailed introduction to the Beam concepts used in these examples, see the [WordCount Example Walkthrough](/get-started/wordcount-example). Here, we'll just focus on executing `WordCount.java`.
-
-## Optional: Convert from Maven to Gradle Project
-
-The steps below explain how to convert the build for the Direct Runner from Maven to Gradle. Converting the builds for the other runners is a more involved process and is out of scope for this guide. For additional guidance, see [Migrating Builds From Apache Maven](https://docs.gradle.org/current/userguide/migrating_from_maven.html).
-
-1. Ensure you are in the same directory as the `pom.xml` file generated from the previous step. Automatically convert your project from Maven to Gradle by running:
-{{< highlight >}}
-$ gradle init
-{{< /highlight >}}
-You'll be asked if you want to generate a Gradle build. Enter **yes**. You'll also be prompted to choose a DSL (Groovy or Kotlin). This tutorial uses Groovy, so select that if you don't have a preference.
-1. After you've converted the project to Gradle, open the generated `build.gradle` file, and, in the `repositories` block, replace `mavenLocal()` with `mavenCentral()`:
-{{< highlight >}}
-repositories {
-    mavenCentral()
-    maven {
-        url = uri('https://repository.apache.org/content/repositories/snapshots/')
-    }
+{{< toc >}}
 
-    maven {
-        url = uri('http://repo.maven.apache.org/maven2')
+## Set up your development environment
+
+1. Download and install the
+  [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/index.html)
+  version 8, 11, or 17. Verify that the
+  [JAVA_HOME](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars001.html)
+  environment variable is set and points to your JDK installation.
+2. Download and install [Apache Maven](https://maven.apache.org/download.cgi) by
+   following the [installation guide](https://maven.apache.org/install.html)
+   for your operating system.
+3. Optional: If you want to convert your Maven project to Gradle, install
+   [Gradle](https://gradle.org/install/).
+
+## Get the example code
+
+1. Generate a Maven example project that builds against the latest Beam release:
+   {{< shell unix >}}
+mvn archetype:generate \
+    -DarchetypeGroupId=org.apache.beam \
+    -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
+    -DarchetypeVersion={{< param release_latest >}} \
+    -DgroupId=org.example \
+    -DartifactId=word-count-beam \
+    -Dversion="0.1" \
+    -Dpackage=org.apache.beam.examples \
+    -DinteractiveMode=false
+   {{< /shell >}}
+   {{< shell powerShell >}}
+mvn archetype:generate `
+  -D archetypeGroupId=org.apache.beam `
+  -D archetypeArtifactId=beam-sdks-java-maven-archetypes-examples `
+  -D archetypeVersion={{< param release_latest >}} `
+  -D groupId=org.example `
+  -D artifactId=word-count-beam `
+  -D version="0.1" `
+  -D package=org.apache.beam.examples `
+  -D interactiveMode=false
+   {{< /shell >}}
+
+   Maven creates a new project in the **word-count-beam** directory.
+
+2. Change into **word-count-beam**:
+   {{< shell unix >}}
+cd word-count-beam/
+   {{< /shell >}}
+   {{< shell powerShell >}}
+cd .\word-count-beam
+   {{< /shell >}}
+   The directory contains a **pom.xml** and a **src** directory with example

Review comment:
       We should use bold for filenames and the red text for code. There's a grey area for filenames in code... I'll fix the pom.xml in the next section. Thanks!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org