This archetype helps to generate the Java Action template project.
The following softwares are required to build and deploy a Java Action to OpenWhisk:
WSK CLI is configured
mvn archetype:generate \ -DarchetypeGroupId=org.apache.openwhisk.java \ -DarchetypeArtifactId=java-action-archetype \ -DarchetypeVersion=1.0-SNAPSHOT \ -DgroupId=com.example \ -DartifactId=demo-function
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" }