Failed to create new hello-world maven project

I watch several maven videos, and then I came across this command after installing maven:

mvn archetype:create -DgroupId=com.di.maven -DartifactId=hello-world 

The build fails and causes the following error:

 Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create (default-cli) on project standalone-pom: Unable to parse configuration of mojo org.apache.maven.plugins:maven-archetype-plugin:2.3:create for parameter #: Abstract class or interface 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated -> [Help 1] 

What is the reason and how can I fix it? I work as a user in Ubuntu.

+57
java maven
Mar 19 '15 at 14:33
source share
4 answers

change create to generate

 mvn archetype:generate -DgroupId=com.di.maven -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 
+163
Mar 19 '15 at 14:47
source share

mvn archetype:create deprecated in Maven 3.0.5 and later, as indicated in the documentation

Use mvn archetype:generate instead:

mvn archetype:generate -DarchetypeArtifactId=maven-archetype-archetype

This is an interactive command and will request values ​​such as groupId , artifactId , version , etc. You can also specify these values ​​in the command and select non-interactive mode.

+71
Apr 09 '15 at 18:14
source share
 mvn archetype:generate -DgroupId=com.biswajit.maven -DartifactId=com.biswajit.maven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

Create does not work in maven 3.0.X or beyond. So use create instead of create

+7
Oct 18 '15 at 5:01
source share

Add

  <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> 

to your pom file in

  {user.home}/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/2.3 
-one
Jun 04 '15 at 18:02
source share



All Articles