Error when creating a new maven project

how to create maven project in eclipse
maven repository
maven dependency problem in eclipse
maven build failure in eclipse
maven not downloading dependencies intellij
how to run maven project
maven update project command
maven project dependency

When I try create a new maven project (with several archetypes, not only the one below), I am facing this error:

Unable to create project from archetype [org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE]
Unable to add module to the current project as it is not of packaging type 'pom'

Anyone know why this is happening, and how to solve it?

It seems that your directory is not empty. this command line works for me: (in an empty directory)

mvn archetype:generate -DgroupId=fr.myGroupId -DartifactId=MyApplication -Dpackagename=fr.myGroupId -DarchetypeArtifactId=maven-archetype-quickstart

the result is:

[INFO] Using property: groupId = fr.myGroupId
[INFO] Using property: artifactId = MyApplication
Define value for property 'version':  1.0-SNAPSHOT: : 
[INFO] Using property: package = fr.myGroupId
Confirm properties configuration:
groupId: fr.myGroupId
artifactId: MyApplication2
version: 1.0-SNAPSHOT
package: fr.myGroupId
 Y: : 
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: fr.myGroupId
[INFO] Parameter: packageName, Value: fr.myGroupId
[INFO] Parameter: package, Value: fr.myGroupId
[INFO] Parameter: artifactId, Value: MyApplication2
[INFO] Parameter: basedir, Value: /home/ABC-OBJECTIF/philippe.demanget/workspace/pdemanget/tmp/mvn
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /home/ABC-OBJECTIF/philippe.demanget/workspace/pdemanget/tmp/mvn/MyApplication2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.764s
[INFO] Finished at: Tue Apr 22 13:35:17 CEST 2014
[INFO] Final Memory: 14M/216M
[INFO] ------------------------------------------------------------------------

I can reproduce your error by doing this command line inside the newly created directory:

cd MyApplication
mvn archetype:create -DgroupId=fr.myGroupId -DartifactId=MyApplication -Dpackagename=fr.myGroupId -DarchetypeArtifactId=maven-archetype-quickstart
[...] [INFO] BUILD FAILURE

Error shown when creating new Maven project in Eclipse, The following steps worked for me: Close Eclipse. Navigate to user home directory. (For example: "C:\Users\YourUserName\.m2"); Delete the  The structure of your pom.xml is wrong. Use this link https://maven.apache.org/pom.html#Dependencies. Put dependency inside tag. If it still doesn't solve your problem could you also make sure that you have this dependency in your repository by navigating to it on a browser. share|improve this answer.

I got the same issue, solved by manually removing a unused pom.xml file at the root of workspace directory

How to fix Maven build issue in Eclipse? Perform maven-clean , Apache Maven is a Software Project Management tool. maven dependency problem eclipse missing artifact; How to fix error “Updating Maven Project”? Create new maven based project or open existing maven project. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:

You have to remove the already existing pom.xml or if you need it to execute the maven command, try adding <packaging>pom</packaging> to your pom.

Since if you have an already existing in the current directory, it should match with the package structure. It is always to good to start with no pom file in the parent directory.

This should work.

Error creating new Java Maven Project, I get the following error: Unable to create project from archetype [org.apache.​maven.archetypes:maven-archetype-quickstart:RELEASE  Eclipse has a problem when trying to access your default workspace where it wants to store your new Maven project. To avoid this error, make sure you clear the the default path, just leave it blank. Make sure that you are crossing "Use default workspace location". This will do the work.

I was having the same problem using Windows PowerShell in a newly created directory with nothing in it. I tried the command using the regular Windows Command Prompt, and it worked fine.

Could not resolve archetype when creating a Maven Project, When attempting to create a Maven project I'm getting a could not resolve archetype. Here is the Detail of the error message: Could not resolve  ERROR: Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-surefire-plugin:maven-plugin:2.12.4:runtime Cause: invalid END header (bad central directory offset) – Fathallah Maha Jul 5 '18 at 10:02

Maven : Archetype error while creating Maven project in Java · Issue , I am trying to create a Maven Project in Java but it is showing error : Could not resolve artifact  Maven uses archetype plugins to create projects. To create a simple java application, we'll use maven-archetype-quickstart plugin. In example below, we'll create a maven based java application project in C:\MVN folder. Let's open the command console, go to the C:\MVN directory and execute the following mvn command.

Maven - How to create a Java project, In this tutorial, we will show you how to use Maven to manage a Java project Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar  mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false. If you have just installed Maven, it may take a while on the first run.

Unable to create a Maven project, After selecting the archetype to create a Maven project the following error occured: Could not resolve archetype  In this tutorial, we will show you how to use Maven to manage a Java project – create, add dependencies and package a Java project into an executable jar file. At the end, we will create an executable jar file to hash a given string with the SHA-256 algorithm.

Comments
  • In the pom.xml file of your project, include this. <packaging>pom</packaging>
  • but i don't have a project yet (I am trying create one). what pom.xml i should modify?
  • what command did you use to create the project?
  • It don't need to be empty, it just need there is no pom.xml in current dir, otherwise current dir will be thought as the parent project, and their packing type need to match
  • Bump into the same error with maven 3.6.0 and I am sure the directory is empty.
  • @KokHowTeh I also have the same issue as you and am on Maven 3.6.0. Trying to create new Maven package, keep giving me the error that "... it is not of packaging type 'pom'."
  • This is exact the issue I got, a pom.xml from where I execute the command cause the issue, and issue fixed after remove the file. Probably it's because mvn though the current dir is an parent project when there is a pom.xml file, and the packing type from the pom.xml is different from what is specified in the command.
  • Holy crap, I spent like three hours trying to figure out my issue. I just removed the pom.xml like you said and it worked.