Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find resource in repository central (http://repo1.maven.org/maven2)

Tags:

maven

In General, what do i do to resolve resource not found in a maven repo, is there another list of repos i can add to pom.xml ? i tried the solution listed as command line, but it did not work, even though maven reported it as being SUCCESS.

I tried to build test-analytics, but got error:

[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
Downloading: http://repo1.maven.org/maven2/com/google/code/gwt-dnd/gwt-dnd/3.1.1/gwt-dnd-3.1.1.pom
[INFO] Unable to find resource 'com.google.code.gwt-dnd:gwt-dnd:pom:3.1.1' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/com/google/code/gwt-dnd/gwt-dnd/3.1.1/gwt-dnd-3.1.1.jar
[INFO] Unable to find resource 'com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) com.google.testing.testify.risk.frontend:test-analytics:war:1.0-SNAPSHOT
    2) com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1

----------
1 required artifact is missing.

for artifact: 
  com.google.testing.testify.risk.frontend:test-analytics:war:1.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Nov 18 21:24:23 EST 2012
[INFO] Final Memory: 16M/238M
[INFO] ------------------------------------------------------------------------

Here is the command and error:

 mvn deploy:deploy-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=gwt-dnd-3.1.1.jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] ------------------------------------------------------------------------
[INFO] Building test-analytics
[INFO]    task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'deploy:deploy-file'

[0] Inside the definition for plugin 'maven-deploy-plugin' specify the following:

<configuration>
  ...
  <url>VALUE</url>
</configuration>

-OR-

on the command line, specify: '-Durl=VALUE'

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Nov 20 14:10:37 EST 2012
[INFO] Final Memory: 14M/238M
[INFO] ------------------------------------------------------------------------
like image 214
kamal Avatar asked Nov 20 '12 18:11

kamal


1 Answers

You are lacking in some fundamental understanding of the Maven world. So, a brief summary of repos should help you.

For starters, there are two repositories available when you run maven "out of the box", wich is what you have done. You have 1) maven central and 2) your local repo, i.e. ~/.m2/repository. The local repository is a sort of cache and the place that artifacts you build locally will be "installed" to via the "mvn install" command. Note, the "mvn deploy" command "deploys" an artifact, which is like an install but it means to put the artifact into a "remote repository". Maven Central is a remote repository, as are all repos except for your single local repo, but you don't deploy to it willy nilly. It's for vetted, release quality artifacts.

So, your build couldn't find the google artifacts. This means that they aren't in Maven Central, though you can check. http://search.maven.org/

If they aren't there you have a few options.

1) "install" the artifacts in your local repo ( this should be your first step since it's extremely lightweight )

2) run your own repository server, such as nexus. This is your own "remote repository", and you can "deploy" the google stuff to it.

3) find out if the google stuff is in another publicly available remote repository -- there are several important ones that aren't in the out of the box maven repo definitions, but you can add them.

Note, these three options aren't so much alternatives as solutions for different situations. If you are just spiking or poc'ing something, I'd go with number #1 for sure. If you are setting up a serious development effort that will use those artifacts, you must do at least #3 and probably #2; #2 is critical to making your life easier if you are really going to be making heavy use of maven. It's also a great educational experience as most of the maven stuff kind of assumes, conceptually, that you have your own repo server.

like image 168
chad Avatar answered Sep 20 '22 11:09

chad