question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running archetype to generate maven lambda is failing

See original GitHub issue

Describe the bug

I’m running the following command to try to generate a lambda maven project. mvn "archetype:generate" "-DarchetypeGroupId=software.amazon.awssdk" "-DarchetypeArtifactId=archetype-lambda" "-DarchetypeVersion=2.11.4" "-DgroupId=com.amazon.test" "-DartifactId=test-project" "-Dservice=s3" "-Dregion=us-west-2" "-DinteractiveMode=false" -e

Expected Behavior

I think it should create the maven project successfully. Was following this page

Current Behavior

I got this error output:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project standalone-pom: Error merging velocity templates: Unable to find resource 'archetype-resources/global.vm' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate (default-cli) on project standalone-pom: Error merging velocity templates: Unable to find resource 'archetype-resources/global.vm'
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Error merging velocity templates: Unable to find resource 'archetype-resources/global.vm'
    at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute (CreateProjectFromArchetypeMojo.java:208)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Steps to Reproduce

Run mvn "archetype:generate" "-DarchetypeGroupId=software.amazon.awssdk" "-DarchetypeArtifactId=archetype-lambda" "-DarchetypeVersion=2.11.4" "-DgroupId=com.michael.test" "-DartifactId=test-project" "-Dservice=s3" "-Dregion=us-west-2" "-DinteractiveMode=false" -e in an empty directory

Possible Solution

Context

I’d like to use this archetype to generate lambda templates.

Your Environment

  • AWS Java SDK version used: N/A since I’m using a maven command, but aws --version returns aws-cli/2.0.38 Python/3.7.7 Windows/10 exe/AMD64
  • JDK version used: 12
  • Operating System and version: windows 10
mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Program Files\apache-maven-3.6.3\bin\..
Java version: 12, vendor: Oracle Corporation, runtime: C:\Program Files\jdk-12
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
zoewanggcommented, Sep 21, 2020

Hi @fjleon1980, we are aware of this issue. Could you try with the workaround?

mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate \
  -DarchetypeGroupId=software.amazon.awssdk \
  -DarchetypeArtifactId=archetype-lambda \
  -DarchetypeVersion=2.14.3 \
  -DgroupId=com.test \
  -DartifactId=sample-project \
  -Dservice=s3 \
  -Dregion=US_WEST_2 \
  -DinteractiveMode=false
0reactions
nkdevirlcommented, Jan 22, 2021

This blog post should be updated to stop other folks trying to find the solution for this bug

https://aws.amazon.com/blogs/developer/bootstrapping-a-java-lambda-application-with-minimal-aws-java-sdk-startup-time-using-maven/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrapping a Java Lambda application with minimal AWS ...
To generate a project, open a terminal (command line) window and run mvn archetype:generate command. There are two modes you can choose: ...
Read more >
java - Maven archetype:generate | Build Failure - Stack Overflow
I installed Maven on a AWS Instance with all All-traffic Open. When I execute "mvn archetype:generate" its showing "Build Failure".
Read more >
Amazon Lambda - Quarkus
Create the Quarkus AWS Lambda maven project using our Maven Archetype. mvn archetype:generate ... There are a few steps to get your lambda...
Read more >
Improving cold start times of Java AWS Lambda functions ...
Quarkus comes with a Maven archetype to scaffold a very simple starting Lambda project. mvn archetype:generate \ -DarchetypeGroupId=io.quarkus \ ...
Read more >
Amazon Lambda - Quarkus
Create the Quarkus AWS Lambda maven project using our Maven Archetype. mvn archetype:generate ... There are a few steps to get your lambda...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found