maven archetype:generate failure caused by org.apa

2019-01-20 13:24发布

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

4条回答
不美不萌又怎样
2楼-- · 2019-01-20 14:10

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.

查看更多
3楼-- · 2019-01-20 14:14

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.

查看更多
趁早两清
4楼-- · 2019-01-20 14:21

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!

查看更多
Juvenile、少年°
5楼-- · 2019-01-20 14:23

Yes, its definitely the permission error. Spent 2 days on it and simply rectified it using sudo :D

查看更多
登录 后发表回答