Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

non readable POM {path} input contain no data

Tags:

java

maven

I am new to Maven. I'm learning it using some books, and when I try to run this in PowerShell:

mvn archetype:generate -DgroupId=net.sirirangan.packt.maven -DartifactId=MySampleApp

I get this error:

Some problems were encountered while processing the POMs: [FATAL] Non-readable POM F:\tt\pom.xml: input contained no data

Even if I execute this: mvn help:effective-pom, I get the same error. What I did is created an empty pom.xml in tt folder and I went to that folder in PowerShell and executed the command.

like image 840
migano Avatar asked May 17 '26 05:05

migano


2 Answers

Maven archetypes are made to generate you projects from scratch; you should have nothing set up before running one. So, you shouldn't have any POM around, empty or otherwise.

There are tons of different archetypes; they are project templates basically. So, you can have an archetype generate you a basic application, or one that generates you a complex web-app with Spring MVC and JPA (for database interactions) in it already.

From this link: https://maven.apache.org/archetypes/maven-archetype-quickstart/

Here is a sample archetype generate command for the quickstart archetype (just a basic maven java project one).

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes \
    -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.3

Note that I added a new line with a \ to make it more readable; you should just take that out and combine the lines as they had in the link.

It looks like you're missing the archetypeArtifactId. What archetype were you trying to use?

Extra Suggestions

Create a nested sub directory and make sure you can create a file there. Then run the generate command from in the directory.

Here's a demonsration of it on my PC:

To Demonstrate

Using Maven version 3.3.3:

> mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.3
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.0-alpha-1 -> http://10.48.82.139/ETCB/nexus/content/groups/fid] found in catalog remote
Define value for property 'groupId': my.group
Define value for property 'artifactId': my-project
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' my.group: :
Confirm properties configuration:
groupId: my.group
artifactId: my-project
version: 1.0-SNAPSHOT
package: my.group
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: maven-archetype-quickstart:1.3
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: my.group
[INFO] Parameter: artifactId, Value: my-project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: my.group
[INFO] Parameter: packageInPathFormat, Value: my/group
[INFO] Parameter: package, Value: my.group
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: my.group
[INFO] Parameter: artifactId, Value: my-project
[INFO] Project created from Archetype in dir: C:\Dev\git\archetype-test\my-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:17 min
[INFO] Finished at: 2018-09-07T14:11:07-04:00
[INFO] Final Memory: 18M/491M
[INFO] ------------------------------------------------------------------------
like image 80
John Humphreys Avatar answered May 18 '26 20:05

John Humphreys


I think your M2_HOME is set to invalid version. Just remove it or correct the path and try again.

like image 31
zhrist Avatar answered May 18 '26 20:05

zhrist