Skip to content

Example of using Maven to use my fork of google-cloud-java as a module in a parent project

Notifications You must be signed in to change notification settings

houglum/maven-multimodule-google-cloud-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting The Code

git clone https://github.com/houglum/maven-multimodule-google-cloud-java
cd maven-multimodule-google-cloud-java
git submodule update --init --recursive

Building/Running

These instructions use Maven to build and run the project.

NOTE: All mvn commands should be run from the root of the repository.

Setting Up Credentials

The main module uses Google Application Default Credentials.

  • If you have a JSON keyfile, run this command so that the program knows where to find your keyfile:

    export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"
  • If you're running on a GCE instance and would like to use GCE service account auth instead of a keyfile, make sure that the instance's default service account has been granted an IAM role that grants the iam.serviceAccounts.signBlob permission.

Building The Project

To build all the modules and avoid running google-cloud-java tests, run:

mvn install -DskipTests

If you'd like to rebuild the project after altering the main module, it is much faster to only recompile that module. This can be accomplished using maven's --projects flag, as shown below:

mvn install -DskipTests --projects main-module

Similarly, if you edit both the google-cloud-storage and main-module projects, you can supply both, delimited by a comma:

mvn install \
    -DskipTests \
    --projects main-module,google-cloud-java/google-cloud-clients/google-cloud-storage

Running The Project

You'll need to supply your resource names used for generating signed URLs:

BKT_NAME="your-bucket-name-here"
GET_OBJ_NAME="name-of-an-object-in-your-bucket-that-already-exists"

# This is the name of the object you want to allow callers to upload bytes for.
# Thus, this object doesn't need to already exist.
PUT_OBJ_NAME="name-of-an-object-you-want-to-create"

After you've built the project, you can invoke this command to run it:

mvn exec:java --projects main-module \
    -Dexec.args="${BKT_NAME:?must be set} ${GET_OBJ_NAME:?must be set} ${PUT_OBJ_NAME:?must be set}"

About

Example of using Maven to use my fork of google-cloud-java as a module in a parent project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages