Azure Functions with Java and Eclipse

Azure Functions with Java is generally available.In this post, I’ll show you how to create Azure Functions with Java and Eclipse.This post assumes that you use Mac OS.Of course, you can with Windows.

https://azure.microsoft.com/en-us/blog/announcing-the-general-availability-of-java-support-in-azure-functions/

 At first, you need to install .NET Core. See the following links for details.

https://dotnet.microsoft.com/download

Next, you need to install Azure Functions Core Tools.Execute the following command in Terminal of Mac OS.

# brew tap azure/functions
# brew install azure-functions-core-tools

In Eclipse, select the File menu, then select Project.Screen Shot 2019-02-28 at 20.00.40

 

Open the Maven Project folder and select Maven Project, then select Next.

Screen Shot 2019-02-28 at 20.01.32

 

Select Next.

Screen Shot 2019-02-28 at 21.23.44

 

Click “Add Archetype…”.

Screen Shot 2019-02-28 at 21.24.00

 

Add the entries for the azure-functions-archetype.

  • Archetype Group ID: com.microsoft.azure
  • Archetype Artifact ID: azure-functions-archetype
  • Version: Use latest version from the central repository

Screen Shot 2019-02-28 at 21.24.53

 

Select Next.

Screen Shot 2019-02-28 at 21.25.07

 

Enter the value based on the Maven Rules in the “Group Id” and “Artifact Id” fields and click “Finish”.

Screen Shot 2019-02-28 at 21.26.55

 

Maven creates the project files in a new folder with a name of artifactId. The follwing code is generated.This code is a simple HTTP triggered function that echoes the body of the triggering HTTP request.

Screen Shot 2019-02-28 at 22.28.36

 

Right-click on the generated project, then choose Run As and Maven build.

Screen Shot 2019-02-28 at 21.31.52

 

In the Edit Configuration dialog, Enter package in the Goals and Name fields, then select Run.

Screen Shot 2019-02-28 at 22.30.40

 

Once the build is complete, create another Run configuration to execute Azure Functions built previously.

Screen Shot 2019-02-28 at 22.37.19

 

In the Edit Configuration dialog, Enter “azure-functions:run” in the Goals and Name fields, then select Run.

Screen Shot 2019-02-28 at 22.36.15

 

The following messages get displayed in Console if execution is successful.

Http Functions:
    HttpTrigger-Java: [GET,POST] https://localhost:7071/api/HttpTrigger-Java

Add a query parameter “name” to the end of the URL as above and access the following URL.

https://localhost:7071/api/HttpTrigger-Java?name=noriyuki

You will see “Hello, noriyuki” on your Web Browser.

ご覧いただきありがとうございます! この投稿はお役に立ちましたか?

役に立った 役に立たなかった

0人がこの投稿は役に立ったと言っています。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です