Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikaello/kotlin-gradle-azure-functions-template
Template for Azure Functions using Kotlin and Gradle
https://github.com/mikaello/kotlin-gradle-azure-functions-template
Last synced: 23 days ago
JSON representation
Template for Azure Functions using Kotlin and Gradle
- Host: GitHub
- URL: https://github.com/mikaello/kotlin-gradle-azure-functions-template
- Owner: mikaello
- License: mit
- Created: 2021-04-11T09:39:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-25T07:07:18.000Z (10 months ago)
- Last Synced: 2024-04-14T12:56:00.056Z (9 months ago)
- Language: Kotlin
- Size: 380 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kotlin and Gradle template for Azure functions
Run Azure Function locally:
```shell
./gradlew jar --info
./gradlew azureFunctionsRun
```## Prerequisites
To develop functions using Kotlin, you must have the following installed:
- [Java Developer Kit](https://docs.microsoft.com/en-us/azure/developer/java/fundamentals/java-jdk-long-term-support), version 8
- [Optional] [Azure CLI](https://docs.microsoft.com/en-us/cli/azure) (needed to deploy)
- [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#v2) version 2.6.666 or above
- [Gradle](https://gradle.org/), version 4.10 and above## Tests
Run tests by:
```shell
./gradlew test
```## Troubleshooting
### WSL
You may need to change the Java path when running on WSL, find the Java Worker config:
```shell
readlink -f $(which func)
# E.g. /usr/lib/azure-functions-core-tools-3/func
```Go into the directory of the Java Worker:
```shell
cd /usr/lib/azure-functions-core-tools-3/workers/java
```Edit the worker config and specify the correct Java executable:
```shell
# Find java executable:
which java
# E.g. /usr/bin/java
```Edit `workers.config.json`:
```diff
{
"description": {
"language": "java",
"extensions": [".jar"],
- "defaultExecutablePath": "%JAVA_HOME%/bin/java",
+ "defaultExecutablePath": "/usr/bin/java",
"defaultWorkerPath": "azure-functions-java-worker.jar",
"arguments": ["-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar", "%JAVA_OPTS%", "%AZURE_FUNCTIONS_MESH_JAVA_OPTS%"]
}
}
```Restart IntelliJ and try again.
## Related
See also:
* Documentation for the Gradle plugin used in this project: [com.microsoft.azure.azurefunctions](https://github.com/microsoft/azure-gradle-plugins/wiki/Azure-Functions-Gradle-Plugin)
* [Azure-Samples/azure-functions-samples-java](https://github.com/Azure-Samples/azure-functions-samples-java) (azure functions + java + gradle)
* [Starter doc](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-maven-kotlin-intellij) for creating azure functions + kotlin + maven