maven-2nifty-gui

Maven install-file won't generate pom.xml


I've installed some third party jars to my repository using the following command:

mvn install:install-file -Dfile=/home/anotherCoder/Downloads/nifty-1.0.jar -DgroupId=nifty-gui -DartifactId=nifty-gui -Dversion=1.0 -Dpackaging=jar

However, once I do mvn compile, maven complains that there is no pom file in the repository and attempts to download it, but can't cause it is not published at any remote repository.

Here is the exact message from maven:

Downloading: http://repo1.maven.org/maven2/nifty-gui/nifty-gui/1.0/nifty-gui-1.0.pom
[INFO] Unable to find resource 'nifty-gui:nifty-gui:pom:1.0' in repository central (http://repo1.maven.org/maven2)

So how do I get maven to generate a pom file for that jar and put it in my local repository?


Solution

  • You tell it to! :-)

    mvn install:install-file
      -Dfile=/home/anotherCoder/Downloads/nifty-1.0.jar
      -DgroupId=nifty-gui
      -DartifactId=nifty-gui
      -Dversion=1.0
      -Dpackaging=jar
      -DgeneratePom=true
    

    (Command placed on multiple lines so you can easily see the last parameter.)

    Nice, huh? In the future you can go to a plug-in's documentation, view its goals, and you can see all the parameters it accepts. For example, the install-file goal.

    Edit:

    Regarding the question of the default behavior of the generatePom flag, the documentation indicates it defaults to true, and the code appears to support that. However, using Maven 2.0.9 with the maven-install-plugin version 2.2 (both versions are slightly out of date), it does not generate a POM. So, perhaps incrementing the version(s) will allow the default to work.

    > touch DeleteMe.jar
    > mvn install:install-file -DgroupId=Delete -DartifactId=Me -Dversion=0.0.0 -Dpackaging=jar -Dfile=DeleteMe.jar
    ...
    [INFO] BUILD SUCCESSFUL
    ...
    > ls ~/.m2/repository/Delete/Me/0.0.0/
    Me-0.0.0.jar
    

    (No generated POM.)