tree: a64acb245162300996407aa00b7c7938d43d55a9 [path history] [tgz]
  1. .travis/
  2. src/
  3. .editorconfig
  4. .gitignore
  5. pom.xml
  6. README.md
java-action-archetype/README.md

Maven Archetype for Java Action

This archetype helps to generate the Java Action template project.

Pre-requisite

The following softwares are required to build and deploy a Java Action to OpenWhisk:

WSK CLI is configured

Install the archetype

mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -V clean install

Generate project

mvn archetype:generate \
  -DarchetypeGroupId=org.apache.openwhisk.java \
  -DarchetypeArtifactId=java-action-archetype \
  -DarchetypeVersion=1.0-SNAPSHOT \
  -DgroupId=com.example \
  -DartifactId=demo-function

Deploying function to OpenWhisk

The following step shows how to deploy the function to OpenWhisk

cd demo-function
mvn clean install
wsk action create demo target/demo-function.jar --main com.example.FunctionApp

After successful deployment of the function, we can invoke the same via wsk action invoke demo --result to see the response as:

{"greetings":  "Hello! Welcome to OpenWhisk" }