test.txt
```
- * Here's an example run of `Stat`, illustrating the use of the gcloud-java-nio jar.
- Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket with a file in it.
- Compile the JAR with:
- ```
- mvn package -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
- ```
- Then run the sample with:
+ * Here's an example run of `Stat`, illustrating the use of gcloud-java-nio.
+
+ Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket with a file in it.
+
+ Run the sample with (from the gcloud-java-examples folder):
```
- java -cp gcloud-java-contrib/gcloud-java-nio/target/gcloud-java-nio-0.1.6-SNAPSHOT-shaded.jar:gcloud-java-examples/target/gcloud-java-examples-0.1.6-SNAPSHOT.jar com.google.gcloud.examples.nio.Stat --check
+ target/appassembler/bin/Stat --check
+
```
Or, if you have a file in `gs://mybucket/myfile.txt`, you can run:
```
- java -cp gcloud-java-contrib/gcloud-java-nio/target/gcloud-java-nio-0.1.6-SNAPSHOT-shaded.jar:gcloud-java-examples/target/gcloud-java-examples-0.1.6-SNAPSHOT.jar com.google.gcloud.examples.nio.Stat gs://mybucket/myfile.txt
+ target/appassembler/bin/Stat gs://mybucket/myfile.txt
```
- The sample doesn't have anything about GCS in it. It gets that ability from the nio jar that
- we're adding to the classpath. You can use the nio "fat shaded" jar for this purpose as it also
- includes the dependencies for gcloud-java-nio.
- If you have access to a project's source code you can also simply add gcloud-java-nio as
- a dependency and let Maven pull in the required dependencies (this is what the nio unit tests do).
- This approach is preferable as the fat jar approach may waste memory on multiple copies of dependencies.
+ The sample doesn't have anything special about GCS in it, it just opens files via the NIO API.
+ It lists gcloud-java-nio as a dependency, and that enables it to interpret `gs://` paths.
Troubleshooting
---------------
diff --git a/gcloud-java-examples/pom.xml b/gcloud-java-examples/pom.xml
index 74cba268e2bd..fb77f1fc3541 100644
--- a/gcloud-java-examples/pom.xml
+++ b/gcloud-java-examples/pom.xml
@@ -21,12 +21,16 @@
gcloud-java
${project.version}
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.5.4
-
-
+
+ ${project.groupId}
+ gcloud-java-nio
+ ${project.version}
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.5.4
+
@@ -37,6 +41,39 @@
false
+
+
+ org.codehaus.mojo
+ appassembler-maven-plugin
+
+
+
+ com.google.gcloud.examples.bigquery.BigQueryExample
+ BigQueryExample
+
+
+ com.google.gcloud.examples.datastore.DatastoreExample
+ DatastoreExample
+
+
+ com.google.gcloud.examples.nio.Stat
+ Stat
+
+
+
+ com.google.gcloud.examples.resourcemanager.ResourceManagerExample
+
+ ResourceManagerExample
+
+
+ com.google.gcloud.examples.storage.StorageExample
+ StorageExample
+
+
+
+
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/nio/Stat.java b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/nio/Stat.java
index 6a0349701804..054657d717ef 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/nio/Stat.java
+++ b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/nio/Stat.java
@@ -20,6 +20,9 @@
* be logged in (using e.g. the gcloud auth command).
*
* See the README for a command line to run this example.
+ *
+ *
In short, this version (in gcloud-java-examples) is in a package that lists gcloud-java-nio
+ * as a dependency, so it will work directly without having to do any special work.
*/
public class Stat {
@@ -77,8 +80,8 @@ private static void help() {
"",
"This tool normally knows nothing of Google Cloud Storage. If you pass it --check",
"or a GCS file name (e.g. gs://mybucket/myfile), it will show an error.",
- "However, by just adding the gcloud-nio jar in your classpath, this tool is made",
- "aware of gs:// paths and can access files on the cloud.",
+ "However, by just adding the gcloud-nio jar as a dependency and recompiling, this tool is",
+ "made aware of gs:// paths and can access files on the cloud.",
"",
"The gcloud NIO filesystem provider can similarly enable existing Java 7 programs",
"to read and write cloud files, even if they have no special built-in cloud support."
@@ -97,7 +100,7 @@ private static void listFilesystems() {
private static void checkGcs() {
FileSystem fs = FileSystems.getFileSystem(URI.create("gs://domain-registry-alpha"));
- System.out.println("We seem to be able to instantiate a gs:// filesystem.");
+ System.out.println("Success! We can instantiate a gs:// filesystem.");
System.out.println("isOpen: " + fs.isOpen());
System.out.println("isReadOnly: " + fs.isReadOnly());
}
diff --git a/utilities/update_docs_version.sh b/utilities/update_docs_version.sh
index 4fc0aa772963..c8f132db2a3c 100755
--- a/utilities/update_docs_version.sh
+++ b/utilities/update_docs_version.sh
@@ -17,7 +17,11 @@ if [ "${RELEASED_VERSION##*-}" != "SNAPSHOT" ]; then
sed -ri "s/:[0-9]+\.[0-9]+\.[0-9]+'/:${RELEASED_VERSION}'/g" ${item}/README.md
sed -ri "s/\"[0-9]+\.[0-9]+\.[0-9]+\"/\"${RELEASED_VERSION}\"/g" ${item}/README.md
done
-
+
+ NEW_VERSION=${RELEASED_VERSION%.*}.$((${RELEASED_VERSION##*.}+1))-SNAPSHOT
+ echo "Changing version to $NEW_VERSION in gcloud-java-nio-example README"
+ sed -ri "s/gcloud-java-nio-examples-[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT/gcloud-java-nio-examples-$NEW_VERSION/g" gcloud-java-contrib/gcloud-java-nio-examples/README.md
+
git add README.md */README.md
git config --global user.name "travis-ci"
git config --global user.email "travis@travis-ci.org"