maven generating pom file

Viewed 122451

I use maven 3.0.3 and have tried to generate pom for third-party jar like this:

mvn install:install-file -Dfile=cobra.jar -DgroupId=com.cobra -DartifactId=cobra -Dversion=0.98.4 -Dpackaging=jar -DgeneratePom=true

According to link below it should generate proper pom.xml and install artifact in the repo. http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html

Meanwhile, it returns such a error:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\cobra-0.98.4\lib). Please verify you invoked Maven from the correct directory. -> [Help 1]

Why is it asking for pom.xml while it should generate pom.xml?

10 Answers

Using maven version 3.6.3, this worked for me to generate pom file in my chosen directory:

C: mvn archetype:generate "-DgroupId=com.mycompany.app" "-DartifactId=my-app" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false"

It worked for me when I changed Powershell to Cygwin. Powershell is somehow parsing the command line argument incorrectly.

I had that error when I was using maven in Windows, what worked for me was opening the cmd and not the PowerShell. Apparently certain errors appear when you don't do it with the cmd. I hope it works.

If you are getting this error during jenkins pipeline setup , Then the error is we are placing git repository without .git in jenkins git url blank .Generally we put website url of git repo but we need to place clone url of git repo.Insert .git (cloned url) to website url , Simply insert git clone url.

Related