London guy
London guy

Reputation: 28032

Unable to create a new maven hello-world project

I am looking at few maven tutorial videos and then I ran into this command after installing maven:

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

The build fails and throws 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 am running as a user in Ubuntu.

Upvotes: 59

Views: 34017

Answers (4)

Suresh
Suresh

Reputation: 1523

mvn archetype:create is deprecated in Maven 3.0.5 and beyond, as mentioned in the documentation

Use mvn archetype:generate instead:

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

This is an interactive command and will ask for values like groupId, artifactId, version, etc. You can also specify these values in the command and choose the non-interactive mode.

Upvotes: 71

user5458751
user5458751

Reputation: 81

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 generate instead of create

Upvotes: 8

Sidhant101
Sidhant101

Reputation: 39

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

Upvotes: -1

Ahmet Karakaya
Ahmet Karakaya

Reputation: 10149

change create to generate

mvn archetype:generate -DgroupId=com.di.maven -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Upvotes: 165

Related Questions