You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2018/08/07 14:41:19 UTC

kudu git commit: [Java] Update readme with Gradle commands

Repository: kudu
Updated Branches:
  refs/heads/master 60b140e26 -> 9939a5136


[Java] Update readme with Gradle commands

Updates the Java readme to use primarily Gradle
commands. Additionally changes the format
from Markdown to AsciiDoc to match our
other readme files.

Includes a couple small fixes to simplifiy Intellij
interaction as described in the readme.
- Adds generated sources for protobuf and avro files
- Uses the sources distribution in the wrapper

Change-Id: I349ac7259beb1f6b80b80265803a06ec532019d7
Reviewed-on: http://gerrit.cloudera.org:8080/11135
Tested-by: Kudu Jenkins
Reviewed-by: Grant Henke <gr...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/9939a513
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/9939a513
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/9939a513

Branch: refs/heads/master
Commit: 9939a5136dc4197f44881daec3de00336e6957df
Parents: 60b140e
Author: Grant Henke <gr...@apache.org>
Authored: Mon Aug 6 21:43:55 2018 -0500
Committer: Grant Henke <gr...@apache.org>
Committed: Tue Aug 7 14:41:11 2018 +0000

----------------------------------------------------------------------
 java/README.adoc                              | 181 +++++++++++++++++++++
 java/README.md                                | 174 --------------------
 java/gradle/protobuf.gradle                   |   7 +
 java/gradle/wrapper.gradle                    |   1 +
 java/gradle/wrapper/gradle-wrapper.properties |   2 +-
 5 files changed, 190 insertions(+), 175 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9939a513/java/README.adoc
----------------------------------------------------------------------
diff --git a/java/README.adoc b/java/README.adoc
new file mode 100644
index 0000000..23052c6
--- /dev/null
+++ b/java/README.adoc
@@ -0,0 +1,181 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+= Kudu Java Developer Documentation
+
+== System Requirements
+
+- Runtime
+    * Java 7+
+- Build time
+    * Java 8+
+- Test time
+    * Built Kudu Binaries
+    * MIT Kerberos (krb5)
+
+WARNING: Support for Java 7 is deprecated as of Kudu 1.5.0 and may be removed in
+the next major release.
+
+== Building Everything
+
+[source,bash]
+----
+$ ./gradlew assemble
+----
+
+== Building Just the Client
+
+[source,bash]
+----
+$ ./gradlew :kudu-client:assemble
+----
+
+The client jar can then be found at `kudu-client/build/libs`.
+
+== Running the Tests
+
+The tests may locate the master and tablet server
+binaries by looking in `build/latest/bin` from the root of
+the git repository. If you have recently built the C++ code
+for Kudu, those should be present already.
+
+If for some reason the binaries aren't in the expected location
+as shown above, you can pass
+`-DbinDir=/path/to/directory`.
+
+Once everything is setup correctly, run:
+
+[source,bash]
+----
+$ ./gradlew test
+----
+
+If you would like to force tests that were already run to re-run
+you can pass `-PrerunTests`.
+
+If you would like to run a subset of the tests or a single test
+you can pass the Gradle `--tests <pattern>` argument to filter
+the tests ran.
+See https://docs.gradle.org/current/userguide/java_testing.html#test_filtering[here]
+for detailed documentation of all pattern options.
+
+Single Test Class Example:
+
+[source,bash]
+----
+$ ./gradlew :kudu-client:test --tests org.apache.kudu.TestColumnSchema
+----
+
+Single Test Method Example:
+
+[source,bash]
+----
+$ ./gradlew :kudu-client:test --tests org.apache.kudu.TestColumnSchema.testEquals
+----
+
+Pattern Example:
+
+[source,bash]
+----
+$ ./gradlew test --tests *IT*
+----
+
+== Additional Gradle Commands
+
+=== Discovering Other Gradle Tasks
+
+[source,bash]
+----
+$ ./gradlew tasks
+----
+
+=== Clearing Build State
+
+[source,bash]
+----
+$ ./gradlew clean
+----
+
+Note: You generally don't need to run this task, but it can be useful
+to rule out any build issues.
+
+=== Installing Artifacts to the Local Maven Repository
+
+[source,bash]
+----
+$ ./gradlew install
+----
+
+=== Checking for Dependency Updates
+
+[source,bash]
+----
+./gradlew dependencyUpdates
+----
+
+NOTE: Additional Gradle command line flag options can be found
+https://docs.gradle.org/current/userguide/command_line_interface.html[here].
+
+== Building with Maven
+
+WARNING: The Maven build is deprecated and may be removed in
+a future release.
+
+Though the Gradle build is the preferred way to build,
+the Maven build still exists and can be used.
+
+=== Running a Full Build
+
+[source,bash]
+----
+$ mvn package -DskipTests
+----
+
+=== Running the Tests
+
+[source,bash]
+----
+$ mvn test
+----
+
+=== Running the Integration Tests
+
+[source,bash]
+----
+$ mvn verify
+----
+
+== Tips for IDEs
+
+=== IntelliJ
+
+Follow the standard instructions as laid out
+https://www.jetbrains.com/help/idea/gradle.html#gradle_import[here]
+to import the Gradle project.
+
+For the most consistent behavior on the command line and
+in the IDE, be sure to enable `Delegate IDE build/run actions to gradle`
+as described https://www.jetbrains.com/help/idea/gradle.html#delegate_build_gradle[here].
+
+=== Eclipse
+
+Follow the instructions as laid out
+http://www.vogella.com/tutorials/EclipseGradle/article.html#eclipse-gradle-support[here]
+to install the Eclipse Gradle (Buildship) tooling.
+Then follow the instruction on the same page
+http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project[here]
+to import an existing project.

http://git-wip-us.apache.org/repos/asf/kudu/blob/9939a513/java/README.md
----------------------------------------------------------------------
diff --git a/java/README.md b/java/README.md
deleted file mode 100644
index 235b506..0000000
--- a/java/README.md
+++ /dev/null
@@ -1,174 +0,0 @@
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Asynchronous Native Java Client for Kudu
-
-System Requirements
-------------------------------------------------------------
-
-- Java 7 or Java 8
-- Maven 3
-- MIT Kerberos (krb5)
-
-WARNING: Support for Java 7 is deprecated as of Kudu 1.5.0 and may be removed in
-the next major release.
-
-Building the Client
-------------------------------------------------------------
-
-$ mvn package -DskipTests
-
-The client jar can then be found at kudu-client/target.
-
-Running the Tests
-------------------------------------------------------------
-
-The unit tests will start a master and a tablet
-server using the flags file located in the src/test/resources/
-directory. The tests will locate the master and tablet server
-binaries by looking in 'build/latest/bin' from the root of
-the git repository. If you have recently built the C++ code
-for Kudu, those should be present already.
-
-Once everything is setup correctly, run:
-
-$ mvn test
-
-If for some reason the binaries aren't in the expected location
-as shown above, you can pass
--DbinDir=/path/to/directory.
-
-Integration tests, including tests which cover Hadoop integration,
-may be run with:
-
-$ mvn verify
-
-NOTE: Running the tests for the kudu-spark and kudu-spark-tools
-module requires Java 8.
-
-State of Eclipse integration
-------------------------------------------------------------
-
-Maven projects can be integrated with Eclipse in one of two
-ways:
-
-1. Import a Maven project using Eclipse's m2e plugin.
-2. Generate Eclipse project files using maven's
-   maven-eclipse-plugin plugin.
-
-Each approach has its own pros and cons.
-
-## m2e integration (Eclipse to Maven)
-
-The m2e approach is generally recommended as m2e is still
-under active development, unlike maven-eclipse-plugin. Much
-of the complexity comes from how m2e maps maven lifecycle
-phases to Eclipse build actions. The problem is that m2e
-must be told what to do with each maven plugin, and this
-information is either conveyed through explicit mapping
-metadata found in pom.xml, or in an m2e "extension". m2e
-ships with extensions for some of the common maven plugins,
-but not for maven-antrun-plugin or maven-protoc-plugin. The
-explicit metadata mapping found in kudu-client/pom.xml has
-placated m2e in both cases (in Eclipse see
-kudu-client->Properties->Maven->Lifecycle Mapping).
-Nevertheless, maven-protoc-plugin isn't being run correctly.
-
-To work around this, you can download, build, and install a
-user-made m2e extension for maven-protoc-plugin:
-
-  http://www.masterzen.fr/2011/12/25/protobuf-maven-m2e-and-eclipse-are-on-a-boat
-
-See http://wiki.eclipse.org/M2E_plugin_execution_not_covered
-for far more excruciating detail.
-
-## maven-eclipse-plugin (Maven to Eclipse)
-
-The maven-eclipse-plugin approach, despite being old
-fashioned and largely unsupported, is easier to use. The
-very first time you want to use it, run the following:
-
-$ mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:configure-workspace
-
-This will add the M2_REPO classpath variable to Eclipse. You
-can verify this in
-Preferences->Java->Build Path->Classpath Variables. It
-should be set to `/home/<user>/.m2/repository`.
-
-To generate the Eclipse project files, run:
-
-$ mvn eclipse:eclipse
-
-If you want to look at Javadoc/source in Eclipse for
-dependent artifacts, run:
-
-$ mvn eclipse:eclipse -DdownloadJavadocs=true -DdownloadSources=true
-
-So what's the problem with maven-eclipse-plugin? The issue
-lies with maven-protoc-plugin. Because all of our .proto
-files are in src/kudu, the "resource path" in
-maven-protoc-plugin must be absolute and prefixed with
-${project.baseDir). This absolute path is copied verbatim
-to an Eclipse .classpath <classpathentry/>, and Eclipse
-doesn't know what to do with it, causing it avoid building
-kudu-client altogether. Other plugins (like
-maven-avro-plugin) don't seem to have this problem, so it's
-likely a bug in maven-protoc-plugin.
-
-There's a simple workaround: delete the errant folder within
-Eclipse and refresh the kudu-client project.
-
-Building with Gradle
---------------------
-
-As an experiment a Gradle build definition also exists.
-In order to run the Gradle build you must install [Gradle|https://gradle.org/].
-If you would rather not install Gradle locally, you can use the
-[Gradle Wrapper|https://docs.gradle.org/current/userguide/gradle_wrapper.html]
-by replacing all references to gradle with gradlew.
-
-## Running a full build
-
-This will build all modules and run all "checks".
-
-$ gradle buildAll
-
-## Building the Client
-$ gradle :kudu-client:assemble
-
-The client jar can then be found at kudu-client/build/libs.
-
-## Running the Tests
-$ gradle test
-
-Integration tests, including tests which cover Hadoop integration,
-may be run with:
-
-$ gradle integrationTest
-
-*Note:* Integration tests may depend on built Kudu binaries.
-
-## Installing to local maven repo
-
-$ gradle install
-
-## Clearing cached build state
-
-$ gradle clean
-
-## Discovering other tasks
-
-$ gradle tasks
-
-
-

http://git-wip-us.apache.org/repos/asf/kudu/blob/9939a513/java/gradle/protobuf.gradle
----------------------------------------------------------------------
diff --git a/java/gradle/protobuf.gradle b/java/gradle/protobuf.gradle
index 54c12cf..f3d84bc 100644
--- a/java/gradle/protobuf.gradle
+++ b/java/gradle/protobuf.gradle
@@ -25,3 +25,10 @@ protobuf {
     artifact = libs.protoc
   }
 }
+
+// Configure Intellij to see the generated classes.
+idea {
+  module {
+    generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kudu/blob/9939a513/java/gradle/wrapper.gradle
----------------------------------------------------------------------
diff --git a/java/gradle/wrapper.gradle b/java/gradle/wrapper.gradle
index 596f92f..c57eac9 100644
--- a/java/gradle/wrapper.gradle
+++ b/java/gradle/wrapper.gradle
@@ -22,6 +22,7 @@
 // Read more about the wrapper here: https://docs.gradle.org/current/userguide/gradle_wrapper.html
 wrapper {
   gradleVersion = versions.gradle
+  distributionType = Wrapper.DistributionType.ALL
 }
 
 def licenseString = """#

http://git-wip-us.apache.org/repos/asf/kudu/blob/9939a513/java/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties
index 8f0e434..20b10aa 100644
--- a/java/gradle/wrapper/gradle-wrapper.properties
+++ b/java/gradle/wrapper/gradle-wrapper.properties
@@ -14,6 +14,6 @@
 # limitations under the License.
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists