Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create a new maven hello-world project

Tags:

java

maven

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 an user in Ubuntu.

like image 581
London guy Avatar asked Mar 19 '15 14:03

London guy


People also ask

Which Maven plugin do we use when we create a Maven project?

For example, to compile your project maven uses maven-compiler-plugin , to run tests - maven-surefire-plugin and so on. Dependency in terms of maven is a packaged piece of classes that your project depends on. It can be jar, war etc.

What is groupId in Maven?

groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org. apache. maven.


Video Answer


2 Answers

change create to generate

mvn archetype:generate -DgroupId=com.di.maven -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 
like image 98
Ahmet Karakaya Avatar answered Oct 10 '22 17:10

Ahmet Karakaya


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.

like image 22
Suresh Avatar answered Oct 10 '22 19:10

Suresh