0

I do not know anything about maven. Recently I downloaded a Android project code and it included pom.xml file. So after searching for hours I manages to properly import it as a maven project. Every thing seems pretty error free but for one item.

Missing artifact org.mapsforge:mapsforge-map:jar:0.3.0

So I looked at my

C:\Users\MWH.m2\repository\org\mapsforge\mapsforge-map\0.3.0

where all of my artifacts are stored. But there is no executable jar file for this mapsforge-map jar. How can I add this jar to this maven project if it is not available in my repository?

Thanks in advance.

MWH
  • 399
  • 1
  • 5
  • 19
  • Just delete the folder '$HOME/.m2/repository/org/mapsforge' and start an other time via 'mvn clean package'. Are you sitting behind a proxy/firewall? – khmarbaise Jun 03 '13 at 07:31

2 Answers2

3

Three special steps:

  1. Download the jar file (from https://code.google.com/p/mapsforge/downloads/list ?)

  2. Copy the jar file to your local Maven repository:

    mvn install:install-file -DgroupId=org.mapsforge -DartifactId=mapsforge-map -Dversion=0.3.0 -Dpackaging=jar -Dfile=mapsforge-map-0.3.0-jar-with-dependencies.jar
    (in the directory you stored the jar file)
  3. Do mvn compile in your project folder to verify the newly-installed dependency is available.

kryger
  • 12,906
  • 8
  • 44
  • 65
  • how can I change the default repo location from http://repo.maven.apache.org/maven2 to http://mc-repo.googlecode.com/svn/maven2/thirdparty/ ? – MWH Jun 03 '13 at 15:59
  • No need to change the defaults, you can easily add a new Maven repository in `pom.xml`: https://maven.apache.org/pom.html#Repositories – kryger Jun 03 '13 at 18:47
0

If it is not available in your repository run the "mvn:clean package" command.Maven will automatically download the dependecy for you.

pinaci
  • 353
  • 4
  • 4
  • [ERROR] Failed to execute goal on project osmdroid-third-party: Could not resolv e dependencies for project org.osmdroid:osmdroid-third-party:jar:3.0.8: The foll owing artifacts could not be resolved: com.google.android.maps:maps:jar:3_r3, or g.mapsforge:mapsforge-map:jar:0.3.0: Failure to find com.google.android.maps:map s:jar:3_r3 in http://repo.maven.apache.org/maven2 was cached in the local reposi tory, resolution will not be reattempted until the update interval of central ha s elapsed or updates are forced -> [Help 1] – MWH Jun 02 '13 at 14:14
  • so how do I do if the above artifacts are not found in the central repository? – MWH Jun 02 '13 at 14:15