Reputation: 3128
I have installed maven 2 and following the tutorial as mentioned in the below link
maven.apache.org/guides/getting-started/maven-in-five-minutes.html
But while executing the archetype:generate command,
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false"
I am getting the below error
[INFO] Trace
org.apache.maven.BuildFailureException: Error merging velocity templates
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: Error merging velocity templates
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute(CreateProjectFromArchetypeMojo.java:211)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
For information,
I am using Sun OpenJDK 1.6.0, Maven 2 and Xubuntu platform.
Any suggestive help on the above error will be appreciated.
Thanks,
Somnath
Upvotes: 4
Views: 8645
Reputation: 4247
If you encounter this error while using an IDE (such as Eclipse) then close and reopen the IDE and try again.
I received this error (Error merging velocity templates
) on Windows 10 using Eclipse after creating then deleting a project into the target folder, then creating my Maven project into the target folder. First, I tried relaxing security on the folder via my Admin account -- but, I was denied access! Finally, after closing Eclipse I saw the folder vanish in Windows Explorer.
I assume that my IDE was exclusively holding the handle for the folder, so it is generally worth noting on Windows that you may have to close other programs (or restart) to fix this issue.
Upvotes: 0
Reputation: 14408
I had also faced the same issue, still I had all the required permissions to create the folder and files. But it turned out that there was an error in archetype.xml - I was trying add a folder without any files in it -
<testResources>
<resource>src/test/resources/</resource>
</testResources>
After correcting archetype.xml, I got the build succeeded.
Upvotes: 2
Reputation: 13
Yes, its definitely the permission error. Spent 2 days on it and simply rectified it using sudo :D
Upvotes: 1
Reputation: 13
I had the same error :D, and what I did was modifying the permission of the folder in which I was creating my project folder (in you case 'my-app'). Indeed, I was just following the maven tutorial's guidelines when I came into this error.
Changing '/usr/local/apache-maven/' folder permission to 775 or to 777 should make it!
Upvotes: 0
Reputation: 1406
It looks like there is a problem with folder access.. Check if the folder where your are trying to create a project is write protected? If it is so, then change its permission to 777 and check if it works.
Upvotes: 8