maven generating pom file

This is an old question, but was a serious PITA for me for a few minutes, so I thought I'd share:

I just ran into this problem, and I believe that the issue is probably platform-dependent. The real tip-off was that the solution from Cyril's answer wasn't working as expected: despite my specification of -DgroupId=com.xyz and -DartifactId=whatever on the command-line and the corresponding entry in the POM file, the jar was installed in the local repo under com/whatever.

This led me to experiment with quoting command-line arguments, and the eventual correct result from formatting the command-line like this (after deleting the POM file):

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

Some of the quoting is doubtless redundant, but better safe than sorry, right? I happen to be running Vista on this computer, and would not be surprised if this problem were specific to this OS version...by the way, this was with Maven v3.0.4.


Are you sure that you are executing the install-file goal? I checked your command and it works for me, but when I place a blank install :install-file (maybe you have this typo) the install goal would be used which needs a pom.xml.

Try to use the -X parameter to get more debug information:

 -X,--debug       Produce execution debug output

My system

Maven

c:\>mvn -version

Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: C:\progs\apache-maven-3.0.3
Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
Java home: c:\Program Files (x86)\Java\jdk1.6.0_21\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

Install Plugin

c:\>mvn -Dplugin=install help:describe

Name: Maven Install Plugin
Description: Copies the project artifacts to the user's local repository.
Group Id: org.apache.maven.plugins
Artifact Id: maven-install-plugin
Version: 2.3.1
Goal Prefix: install

This plugin has 3 goals:

install:help
  Description: Display help information on maven-install-plugin.
    Call
      mvn install:help -Ddetail=true -Dgoal=<goal-name>
    to display parameter details.

install:install
  Description: Installs the project's main artifact in the local repository.

install:install-file
  Description: Installs a file in the local repository.

For more information, run 'mvn help:describe [...] -Ddetail'