Giter VIP home page Giter VIP logo

azure-maven-archetypes's Introduction

Maven Archetypes for Azure

This repo contains Maven Archetypes for Azure. The following table lists Maven Archetypes for azure services.

Note The Azure SDK maven archetype can be found at the Azure SDK GitHub repository.

Archetype Artifact Id Archetype Group Id Maven Central Version
azure-functions-archetype com.microsoft.azure Maven Central
azure-functions-kotlin-archetype com.microsoft.azure Maven Central
azure-iot-edge-archetype com.microsoft.azure Maven Central
apache-spark-archetype com.microsoft.azure Maven Central

Related repository: azure-maven-plugins

You may be also interested in the Azure Maven Plugins. These archetypes are very closely related to the plugins, and both kinds of artifacts work together to give you Java your way on Azure.

Of particular interest to users of these archetypes is the azure-webapp-maven-plugin and its config goal. This goal acts like an archetype. It instruments the current project's POM so that the target artifact can subsequently be published to Azure App Service using the deploy goal.

Reporting Issues and Feedback

If you encounter any bugs with the Maven Archetypes, please file an issue in the Issues section of our GitHub repo.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-maven-archetypes's People

Contributors

adashen avatar ashiquemd avatar brettsam avatar brostbeef avatar brunoborges avatar dependabot[bot] avatar edburns avatar flanker32 avatar formulahendry avatar ggailey777 avatar gloveboxes avatar jdneo avatar jeffhollan avatar lucyzhang929 avatar marianan avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar pragnagopa avatar t-rufang avatar xscript avatar yevster avatar zhijunzhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-maven-archetypes's Issues

javaVersion parameter is ignored

Repro steps:
Run a command like:

mvn archetype:generate -DarchetypeGroupId='com.microsoft.azure' -DarchetypeArtifactId='azure-functions-archetype' -DjavaVersion='11' -DgroupId='com.function' -DartifactId='ja2' -Dversion='1.0-SNAPSHOT' -Dpackage='com.function' -DappName='ja2-1598029847902' -B

Expected:
"java.version" is set to 11 in pom.xml

Actual:
"java.version" is still 1.8

Seems like it has to do with the "javaVersion" logic being inside this "if" condition here: https://github.com/microsoft/azure-maven-archetypes/blob/develop/azure-functions-archetype/src/main/resources/META-INF/archetype-post-generate.groovy#L26

We always specify an appName in the Azure Functions extension, so it always skips that part

Java templates don't include right .gitignore

By @jeffhollan:

Realize this may need to move to the Java maven archetype (not sure) but the .gitignore included needs the following to be valid:

local.settings.json
bin/
obj/

Will keep out the local settings which shouldn't be in source control, and any binaries that may be installed as extensions

appName parameter is ignored for azure functions

The VS Code extension runs a command like this to generate a new java project:

mvn archetype:generate -DarchetypeGroupId='com.microsoft.azure' -DarchetypeArtifactId='azure-functions-archetype' -DgroupId='com.function' -DartifactId='javart1' -Dversion='1.0-SNAPSHOT' -Dpackage='com.function' -DappName='myappname1' -B

In the past, it would set this in the new pom.xml:

<functionAppName>myappname1</functionAppName>

But now it's ignoring the appName parameter and always doing a name like this:

<functionAppName>javart1-20200227165500266</functionAppName>

Should the VS Code extension stop prompting for appName? I don't have a preference, but the README here seems to imply the parameter is still supported: https://github.com/microsoft/azure-maven-archetypes/tree/develop/azure-functions-archetype#azure-parameters

@Flanker32 @andxu Seems like this PR is what changed it: #128

Considering add FUNCTIONS_WORKER_RUNTIME=java into the <appSetting> field

According to the new App Service Annoucement: Azure/app-service-announcements#129

Choose a language for a Function App

  • If your app contains functions with a single language for example only CSharp functions, then no action is needed
  • If your app contains functions with multiple languages for example, CSharp and JavaScript then
    Select a language: by adding an App setting named FUNCTIONS_WORKER_RUNTIME
    • Set value to dotnet for CSharp/Fsharp/Precompiled samples
    • Set value to node for JavaScript samples
    • Set value to java for run Java samples

We should consider whether we need to add FUNCTIONS_WORKER_RUNTIME: java into the application settings of the function archetype.

Java Azure Functions creation from Maven artifact fails

Plugin name and version

Following the docs here, I am running the following command to generate the function on a Mac:

mvn archetype:generate \
    -DarchetypeGroupId=com.microsoft.azure \
    -DarchetypeArtifactId=azure-functions-archetype 

Plugin configuration in your pom.xml

Following the docs here, I am running the maven generate from archetype command in an empty directory.

Expected behavior

Docs define the expected behavior:

Define value for property 'groupId': com.fabrikam.functions
Define value for property 'artifactId' : fabrikam-functions
Define value for property 'version' 1.0-SNAPSHOT : 
Define value for property 'package': com.fabrikam.functions
Define value for property 'appName' fabrikam-functions-20170927220323382:
Confirm properties configuration: Y

Actual behavior

lena:JavaFunctions lenok$ mvn archetype:generate \
>     -DarchetypeGroupId=com.microsoft.azure \
>     -DarchetypeArtifactId=azure-functions-archetype
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype [com.microsoft.azure:azure-functions-archetype:1.19] found in catalog remote
Define value for property 'groupId': : com.lena
[INFO] Using property: groupId = com.lena
Define value for property 'artifactId': : lena-test-function
[INFO] Using property: artifactId = lena-test-function
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.lena: :
Feb 28, 2019 10:26:29 AM org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
Feb 28, 2019 10:26:29 AM org.apache.velocity.runtime.log.JdkLogChute log
INFO: Null reference [template 'appName', line 1, column 29] : ${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))} cannot be resolved.
Define value for property 'appName':  lena-test-function-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))}: : app
Feb 28, 2019 10:26:36 AM org.apache.velocity.runtime.log.JdkLogChute log
INFO: Null reference [template 'appRegion', line 1, column 1] : ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("westus").toString()} cannot be resolved.
Define value for property 'appRegion':  ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("westus").toString()}: : ^Clena:JavaFunctions lenok$
lena:JavaFunctions lenok$ mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T11:41:47-07:00)
Maven home: /opt/apache-maven-3.6.0
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.5", arch: "x86_64", family: "mac"
lena:JavaFunctions lenok$

For some reason, the project generation gets stuck after asking for package name. Maven, Java, and Mac Os versions are in the output above.

Functions Archetype has outdated Test class

Generated a project using the latest archetype.

Test class does not compile as it references old APIs.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.361 s
[INFO] Finished at: 2018-09-21T09:04:34-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project myfuncsep18: Compilation failure: Compilation failure:
[ERROR] /Users/bruno/work/azure/demos/myfuncsep18/src/test/java/com/microsoft/samples/FunctionTest.java:[55,25] cannot find symbol
[ERROR]   symbol:   method getStatus()
[ERROR]   location: variable ret of type com.microsoft.azure.functions.HttpResponseMessage
[ERROR] /Users/bruno/work/azure/demos/myfuncsep18/src/test/java/com/microsoft/samples/HttpResponseMessageMock.java:[10,8] com.microsoft.samples.HttpResponseMessageMock is not abstract and does not override abstract method getHttpStatus() in com.microsoft.azure.functions.HttpResponseMessage
[ERROR] /Users/bruno/work/azure/demos/myfuncsep18/src/test/java/com/microsoft/samples/HttpResponseMessageMock.java:[21,5] method does not override or implement a method from a supertype
[ERROR] /Users/bruno/work/azure/demos/myfuncsep18/src/test/java/com/microsoft/samples/HttpResponseMessageMock.java:[34,19] com.microsoft.samples.HttpResponseMessageMock.HttpResponseMessageBuilderMock is not abstract and does not override abstract method status(int) in com.microsoft.azure.functions.HttpResponseMessage.Builder

Standardize Git Branches and Tags

It is very common practice, on GitHub and at almost all Azure/Microsoft repositories to use master branch as the upstream (latest working/released version) as well the default branch of the GitHub repository.

Tags are good to use to point to previous released versions.

For tags, something that points to the source code of the specific released artifact and version.

Would be good to standardize it this way.

Updated by @jdneo

We have two tasks here.

  • rename the tags to remove v
  • change the branch model

Running default unit test gives nullpointerexception

Hello,

Are you there problems with running unit tests for a standard http trigger azure functions? Just running the default one that is generated gives a nullpointerexception straight away even though the logs indicate that the functions seems to have run correctly. When I run the function locally and send a http request everything works fine.

mvn azure-functions:package doesn't work`

When I run mvn azure-functions:package it creates a target directory that only has a host.json. Doing mvn package works fine. Not sure why the former doesn't work, but should likely either remove or fix.

Archetype tries to create invalid directory name at time of project definition

Eclipse: Version: 2019-12 (4.14.0) Build id: 20191212-1212
The pom contains the error immediately after the project is created; without a fix I can't proceed.

Caused by: org.apache.maven.plugin.MojoExecutionException: Illegal char <"> at index 115: C:\Users\rober\eclipse-workspace\example_module\target\azure-functions\example_module-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))}
at com.microsoft.azure.maven.AbstractAzureMojo.handleException (AbstractAzureMojo.java:505)
at com.microsoft.azure.maven.AbstractAzureMojo.execute (AbstractAzureMojo.java:439)
at com.microsoft.azure.maven.function.AbstractFunctionMojo.execute (AbstractFunctionMojo.java:166)

====================pom============================

4.0.0
<groupId>com.ms.samples.motw.groupId</groupId>
<artifactId>com.ms.sample.motw.artifactid</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Azure Java Functions</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <azure.functions.maven.plugin.version>1.4.1</azure.functions.maven.plugin.version>
    <azure.functions.java.library.version>1.3.1</azure.functions.java.library.version>
    <functionAppName>com.ms.sample.motw.artifactid-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))}</functionAppName>
    <stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
</properties>

<repositories>
    <repository>
        <id>maven.snapshots</id>
        <name>Maven Central Snapshot Repository</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>maven.snapshots</id>
        <name>Maven Central Snapshot Repository</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.23.4</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.azure.functions</groupId>
            <artifactId>azure-functions-java-library</artifactId>
            <version>${azure.functions.java.library.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>com.microsoft.azure.functions</groupId>
        <artifactId>azure-functions-java-library</artifactId>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-functions-maven-plugin</artifactId>
                <version>${azure.functions.maven.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>azure-functions-maven-plugin</artifactId>
            <configuration>
                <!-- function app name -->
                <appName>${functionAppName}</appName>
                <!-- function app resource group -->
                <resourceGroup>java-functions-group</resourceGroup>
                <!-- function app service plan name -->
                <appServicePlanName>java-functions-app-service-plan</appServicePlanName>
                <!-- function app region-->
                <!-- refers https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-functions-maven-plugin#supported-regions for all valid values -->
                <region>westus</region>
                <!-- function pricingTier, default to be consumption if not specified -->
                <!-- refers https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-functions-maven-plugin#supported-pricing-tiers for all valid values -->
                <!-- <pricingTier></pricingTier> -->
                <runtime>
                    <!-- runtime os, could be windows, linux or docker-->
                    <os>windows</os>
                    <!-- for docker function, please set the following parameters -->
                    <!-- <image>[hub-user/]repo-name[:tag]</image> -->
                    <!-- <serverId></serverId> -->
                    <!-- <registryUrl></registryUrl>  -->
                </runtime>
                <appSettings>
                    <property>
                        <name>FUNCTIONS_EXTENSION_VERSION</name>
                        <value>~3</value>
                    </property>
                </appSettings>
            </configuration>
            <executions>
                <execution>
                    <id>package-functions</id>
                    <goals>
                        <goal>package</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <overwrite>true</overwrite>
                        <outputDirectory>${stagingDirectory}</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.basedir}</directory>
                                <includes>
                                    <include>host.json</include>
                                    <include>local.settings.json</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${stagingDirectory}/lib</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <includeScope>runtime</includeScope>
                        <excludeArtifactIds>azure-functions-java-library</excludeArtifactIds>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!--Remove obj folder generated by .NET SDK in maven clean-->
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>obj</directory>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
    </plugins>
</build>

Name issue for package and appName properties

The expression '[A-Za-z0-9_-.]+' is good to name groupid and artifactid.
And the value of package property will set the default value to groupid, and value of appName will use the artifactid to set the default name prefix. Now the issue is that the expression '[A-Za-z0-9_-.]+' do not apply to package and appname if user choose default value of package and appname.

e.g.
image
image

Version name - should be 1.1-beta

instead of a snapshot. Also, we should use 1.1 consistently everywhere. There are some traces of 1.0-Snapshot when you use the archetype

Default unit test for doesn't test anything

by @hf-kklein in microsoft/vscode-azurefunctions#491 (comment):

Steps to reproduce:

  • create a new Azure Function Project using the Azure Function VS Code PlugIn . Choose language Java and default values.
  • The path src\test\java\com\function\FunctionTest.java contains an autogenerated unit test for the Function class in src\main\java\com\function\Function.java.
  • One would expect the test to fail, if the HTTP status code of the repsonse generated by the Azure Function inside the Function class returns something is different from 200 -- OK.
  • Run original test => passed;
  • Modify the Azure Function HttpTriggerJava in Function´.java:
    replace this part (lines 26-30)
if (name == null) {
     return request.createResponse(400, "Please pass a name on the query string or in the request body");
} else {
     return request.createResponse(200, "Hello, " + name);
}

with this:

return request.createResponse(500, "This unit test is pointless");
  • Run test again => still passes.

By default you're mocking all characteristics of the response. Except for the case when the function returns null, the test can never fail.

Generating from archetype fails to populate plugin properties

by @rloutlaw

Plugin name and version

1.11 and 1.12 Maven releases from maven central. Java 8 and Maven 3.5.4.

Plugin configuration in your pom.xml

Relevant failing part:

UTF-8 1.8 1.8 1.0.0-beta-3 1.0.0-beta-4 helloworld-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))} ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("westus").toString()} ${project.build.directory}/azure-functions/${functionAppName} ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("java-functions-group").toString()}

Expected behavior

The functionAppName, AppRegion, and other fields have proper variable interpolation.

Actual behavior

Fields aren't generated / interpolated properly.

Steps to reproduce the problem

Generate a new project from archtype from Windows command line, Eclipse, or IntellliJ.

Create 'Dockerfile' in the project when docker property is set false

Environment:

Eclipse: 2019-12
azure-functions-archetype: 1.26

Reproduce Steps:

  1. In Eclipse, select the File menu, then select New -> Maven Project.
  2. Accept the defaults in the New Maven Project dialogue and select Next.
  3. Select Add Archetype and add the entries for the azure-functions-archetype.
    • Archetype Group ID: com.microsoft.azure
    • Archetype Artifact ID: azure-functions-archetype
    • Version: Use latest version 1.26 from the central repository
      image
  4. Click OK and then click Next. Be sure to fill in values for all of the fields, and eventually Finish.

Result:

Create 'Dockerfile' in the project when docker property is set false.
image

Make "resourceGroup" configurable-project creation time

It would be great to make the resourceGroup setting flexible, in a similar way than the region for which the default value is westus.

This would allow users to override the default java-functions-group value while invoking the archetype. Otherwise, the user may initially forget about it, until deployment failures happen, when there are no user roles/permissions for creating resource groups.

Can not run the project locally with mvn azure-functions:run

I'm following the guide from here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven

And installed the Azure Functions Core Tools, as seen here:
https://imgur.com/a/xRyBjBu

I use IntelliJ's maven plugin, to package the project with mvn clean package (I have the correct working directory set), but then when trying to run the project with azure-functions:run -X, I get the following stacktrace:

Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.0.0-beta-2:run (default-cli) on project still_rca_azure_function: Azure Functions Core Tools not found. Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.0.0-beta-2:run (default-cli) on project still_rca_azure_function: Azure Functions Core Tools not found. Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.maven.plugin.MojoExecutionException: Azure Functions Core Tools not found. Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first. at com.microsoft.azure.maven.AbstractAzureMojo.handleException(AbstractAzureMojo.java:347) at com.microsoft.azure.maven.AbstractAzureMojo.execute(AbstractAzureMojo.java:293) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 21 more Caused by: java.lang.Exception: Azure Functions Core Tools not found. Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first. at com.microsoft.azure.maven.function.handlers.CommandHandlerImpl.handleExitValue(CommandHandlerImpl.java:103) at com.microsoft.azure.maven.function.handlers.CommandHandlerImpl.runCommandWithReturnCodeCheck(CommandHandlerImpl.java:39) at com.microsoft.azure.maven.function.RunMojo.checkRuntimeExistence(RunMojo.java:57) at com.microsoft.azure.maven.function.RunMojo.doExecute(RunMojo.java:43) at com.microsoft.azure.maven.AbstractAzureMojo.execute(AbstractAzureMojo.java:288) ... 23 more

I'm using Windows 10 Pro. What can I do? It would be nice to debug the Azure Function I want to write, before deploying it to the cloud.

Can't generate a project with the specified trigger in a folder with blank space

Environment:

  • Maven: 3.6.3
  • JDK: 11.0.8
  • Azure-functions-archetype: 1.37

Reproduce Steps:

  1. Open a terminal in an empty folder with blank space
  2. Run command line to generate a project with specified trggier. eg: mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DarchetypeVersion=1.36 -Dtrigger=TimerTrigger

Result:

image

Can not run java azure function locally, created using maven archetype:generate given on microsoft site using mvn azure-functions:run, not showing error. Its simply freezing.

Followed every step and verified many times mentioned in below link:
https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java?tabs=bash%2Cazure-cli%2Cbrowser
Below is screenshot of cmd running mvn azure-functions:run command
image

I tried to run mvn azure-functions:run -X and its showing below and freezing:
image

Default pricingTier not was set EP1 in docker pom.xml

Environment:
Maven: 3.6.3
JDK: 1.8.0-281
Azure-functions-archetype: 1.38-SNAPSHOT
Reproduce Steps:

  1. Run mvn archetype:generate -DarchetypeCatalog=local -Ddocker to generate to function project
  2. Open pom.xml, observe default pricingTier not was set EP1

Result:
image

GroupId and artifactId will confirm twice when generate archetype

Plugin name and version

azure-functions-archetype 1.30.0

Steps to reproduce the problem

Run mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DarchetypeVersion=1.30 to generate archetype

Actual behavior

When confirm your configuration, groupId and artifactId will confirm twice
image

The azure-functions-archetype artifact is not an archetype

When I tried to create project for azure functions using azure-functions-archetype in eclipse, I encountered the problem as follows

Unable to create project from archetype [com.microsoft.azure:azure-functions-archetype:1.39 -> https://repo1.maven.org/maven2/]
The defined artifact is not an archetype

Can anyone help me solve the issue?
Thank you

Some parameters no default value when generate using function archetype

Environment:

  • OS: Windows/Mac/Linux JDK8
  • azure-functions-archetype: 1.34-SNAPSHOT

Reproduce Steps:

  1. To create a function project with a specific trigger, please use -Dtrigger to specify the QueueTrigger and EventHubTrigger

Actual Result:

Queue name no default value
image

consumerGroup no default value (Only reproduce in Mac and Linux)
image

Add FUNCTIONS_WORKER_RUNTIME to local.settings.json

In Azure Function Core Tools v2.0.1-beta.31

your worker runtime is not set. As of 2.0.1-beta.26 a worker runtime setting is required.
Please run `func settings add FUNCTIONS_WORKER_RUNTIME <option>` or add FUNCTIONS_WORKER_RUNTIME to your local.settings.json
Available options: dotnet, node, java

Functions archetypes should use V3 bundle version when available

This is a tracking item for action to take once the V3 bundle exists in the main bundle ID.

The current host.json that is checked in uses V1 of the bundles:

{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}

#181 tracks making this V2 now.

However, once the V3 bundle is finalized, we should update it to use V3:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.*, 4.0.0)"
  } 
}

Show more friendly info to users

Plugin name and version: azure-maven-archetypes: 1.15

Info should match expression '[A-Za-z0-9_-.]+' that are very unfriendly to users
image

Functions archetypes should use V2 bundle version

The current host.json that is checked in uses V1 of the bundles:

{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}

This actually should be using V2:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  } 
}

There are some warning when Generate archetype

Plugin name and version

azure-maven-archetypes: 1.17

Plugin configuration in your settings.xml

<profiles>
    <profile>
      <id>archetype</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>archetype</id>
          <url>https://oss.sonatype.org/content/repositories/commicrosoftazure-2697/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>

Actual behavior

image
image

Steps to reproduce the problem

  1. Add the release profile in maven settings.xml file
  2. Run mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-
    functions-archetype -DarchetypeVersion=1.17 to generate a java funtion project

Change template so Azure Functions bundles work

We are removing the requirement of having .NET Core SDK installed to use extensions with functions. To use this, instead of doing func extensions install you can have a host.json that includes bundling information. The runtime can than use pre-built extensions automatically without requiring a .NET build.

We should update the archetype template to include this.

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[1.*, 2.0.0)"
        }
}

There is a warning when compiling the test file which generated by archetype

Plugin name and version

azure-maven-archetypes: 1.17-SNAPSHOT

Plugin configuration in your pom.xml

...
    <properties>
      ...
        <azure.functions.maven.plugin.version>1.0.0-beta-8-SNAPSHOT</azure.functions.maven.plugin.version>
        <azure.functions.java.library.version>1.0.0-beta-7-SNAPSHOT</azure.functions.java.library.version>
        <functionAppName>demo7-20181102104335824</functionAppName>
        <functionAppRegion>westus</functionAppRegion>
        <stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
        <functionResourceGroup>java-functions-group</functionResourceGroup>
    </properties>

        <pluginRepositories>
        <pluginRepository>
            <id>maven.snapshots</id>
            <name>Maven Central Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

...
        <plugins>
            <plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-functions-maven-plugin</artifactId>
                <configuration>
                    <resourceGroup>${functionResourceGroup}</resourceGroup>
                    <appName>${functionAppName}</appName>
                    <region>${functionAppRegion}</region>
                    <appSettings>
                        <!-- Run Azure Function from package file by default -->
                        <property>
                            <name>WEBSITE_RUN_FROM_PACKAGE</name>
                            <value>1</value>
                        </property>
                        <property>
                            <name>FUNCTIONS_EXTENSION_VERSION</name>
                            <value>~2</value>
                        </property>
                        <property>
                            <name>FUNCTIONS_WORKER_RUNTIME</name>
                            <value>java</value>
                        </property>
                    </appSettings>
                </configuration>
                <executions>
                    <execution>
                        <id>package-functions</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
...

Actual behavior

image

Steps to reproduce the problem

  1. Add the regression profile in maven settings.xml file
  2. Run mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DarchetypeVersion=1.17-SNAPSHOT to generate a java funtion project
  3. Add the regression test seetings in pom.xml and set the SNAPSHOT version <azure.functions.maven.plugin.version>1.0.0-beta-8-SNAPSHOT</azure.functions.maven.plugin.version> in pom.
  4. mvn clean package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.