How shoud i install missing artifacts in a maven project

Tag: maven Author: s2009linshi Date: 2011-03-07

I am getting the following error, upon running mvn clean install

Missing:
----------
1) org.apache.maven.shared:maven-invoker:jar:2.0.6

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.maven.shared -DartifactId=maven-invoker -Dversion=2.0.6 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.apache.maven.shared -DartifactId=maven-invoker -Dversion=2.0.6 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4
    2) org.apache.maven.shared:maven-invoker:jar:2.0.6

2) org.apache.maven.archetype:archetype-common:jar:2.0-alpha-4

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.apache.maven.archetype -DartifactId=archetype-common -Dversion=2.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.apache.maven.archetype -DartifactId=archetype-common -Dversion=2.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4
    2) org.apache.maven.archetype:archetype-common:jar:2.0-alpha-4

----------
2 required artifacts are missing.

for artifact: 
  org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:2.0-alpha-4

from the specified remote repositories:
  nexus (http://nexus.browsermob.com/content/groups/public/)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Mar 23 14:16:32 EDT 2011
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------

Best Answer

These artifacts are available in main maven repository: maven-invoker:2.0.6 and archetype-common:2.0-alpha-4 and they should be resolved automatically.

Your problem is this Nexus repository: http://nexus.browsermob.com. I don't have access to it, but it must be configured to proxy maven central repository. If you are an employee of BrowserMob, ask person responsible for Nexus server. If not - just remove this repository from pom.xml or settings.xml globally. Chances are you will be able to build the project successfully.

Other Answer1

It looks like the repository you're using (http://nexus.browsermob.com/content/groups/public/) doesn't include some of the common maven plugins.

You have a couple of options:

  1. Configure the nexus.browsermob.com repo so that it proxies artifacts from maven central
  2. Add the maven central repository into your local settings file

If you want to go for option 2, add this into the <repositories> section of you settings file (which is typically found in your home folder in .m2/settings.xml):

<repository>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <id>central</id>
    <url>http://repo1.maven.org/maven2</url>
</repository>

and this into the <pluginRepositories> section:

<pluginRepository>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <id>central</id>
    <url>http://repo1.maven.org/maven2</url>
</pluginRepository>

Other Answer2

Just paste "http://nexus.browsermob.com/content/groups/public/" to your web browser and see the list of libraries there. You will see that the libraries are absent from there or they are with different version numbers.(this is highly possible.)

Soultion is:

Have fun.