1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/serverless-quarkus-template.adoc

64 lines
2.1 KiB
Plaintext

// Module included in the following assemblies
//
// * serverless/functions/serverless-developing-quarkus-functions.adoc
:_mod-docs-content-type: REFERENCE
[id="serverless-quarkus-template_{context}"]
= Quarkus function template structure
When you create a Quarkus function by using the Knative (`kn`) CLI, the project directory looks similar to a typical Maven project. Additionally, the project contains the `func.yaml` file, which is used for configuring the function.
Both `http` and `event` trigger functions have the same template structure:
.Template structure
[source,terminal]
----
.
├── func.yaml <1>
├── mvnw
├── mvnw.cmd
├── pom.xml <2>
├── README.md
└── src
├── main
│ ├── java
│ │ └── functions
│ │ ├── Function.java <3>
│ │ ├── Input.java
│ │ └── Output.java
│ └── resources
│ └── application.properties
└── test
└── java
└── functions <4>
├── FunctionTest.java
└── NativeFunctionIT.java
----
<1> Used to determine the image name and registry.
<2> The Project Object Model (POM) file contains project configuration, such as information about dependencies. You can add additional dependencies by modifying this file.
+
.Example of additional dependencies
[source,xml]
----
...
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
...
----
+
Dependencies are downloaded during the first compilation.
<3> The function project must contain a Java method annotated with `@Funq`. You can place this method in the `Function.java` class.
<4> Contains simple test cases that can be used to test your function locally.