Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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" }