Main Tutorials

How to add remote repository in Maven

Not every library is stored in the Maven Central Repository, some libraries are only available in Java.net or JBoss repository (remote repository).

1. Java.net Repository

pom.xml

  <repositories>
        <repository>
            <id>java-net-repo</id>
            <url>https://maven.java.net/content/repositories/public/</url>
        </repository>     
  </repositories>

2. JBoss Repository

pom.xml

  <repositories>
        <repository>
            <id>jboss-repo</id>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
  </repositories>

3. Spring Repository

pom.xml

  <repositories>
        <repository>
            <id>spring-repo</id>
            <url>https://repo.spring.io/release</url>
        </repository>
  </repositories>

References

  1. Configuring Maven to use the JBoss Repository
  2. Spring Repository

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
30 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
veeru
10 years ago

Hi, i have a one jar in my local repositiry(system1),and my friend want to access my jar in his project(system2) by using maven can any one please help me.

Antonio
3 years ago

Hello,

What about a private remote repositoy with user and password? Something like :
a. Repository id: fake-repo
b. URL: http://myfakemaven.repo.com
c. User: dev
d. Password: dev-password

yasitha
2 years ago

thanks

vijayan
4 years ago

Hi
Based on profile how i can give the repository (custom repo url)

Jason Rembert
8 years ago

you can download the files directly incl dependencies from a remote repository on this site: http://jar-download.com/maven-dependency-from-remote-repository.php

pankaj jangir
8 years ago

Hello mykong,

i am trying to compile saiku 2.5 tool on netbeans

when i right click the project and click on clean and build it is giving following error.

BUILD FAILURE

————————————————————————

Total time: 9:14.264s

Finished at: Fri Aug 07 18:10:08 IST 2015

Final Memory: 5M/15M

————————————————————————

Failed to execute goal on project saiku-service: Could not resolve dependencies for project org.saiku:saiku-service:jar:2.5: Failed to collect dependencies for [org.olap4j:olap4j:jar:1.2.0-SNAPSHOT (compile), org.apache.poi:poi:jar:3.7 (compile), org.apache.poi:poi-ooxml:jar:3.7 (compile), eigenbase:eigenbase-properties:jar:1.1.0.10924 (compile), eigenbase:eigenbase-resgen:jar:1.3.0.11873 (compile), eigenbase:eigenbase-xom:jar:1.3.0.11999 (compile), org.jdom:jdom:jar:1.1 (compile), org.slf4j:slf4j-log4j12:jar:1.6.4 (compile), org.slf4j:slf4j-api:jar:1.6.4 (compile), log4j:log4j:jar:1.2.14 (compile), junit:junit:jar:4.10 (compile), hsqldb:hsqldb:jar:1.8.0.10 (compile), pentaho:mondrian:jar:3.5.7 (compile), commons-lang:commons-lang:jar:2.2 (compile), javax.servlet:javax.servlet-api:jar:3.1.0 (compile), org.apache.commons:commons-io:jar:1.3.2 (compile), commons-vfs:commons-vfs:jar:1.0 (compile)]: Failed to read artifact descriptor for org.olap4j:olap4j:jar:1.2.0-SNAPSHOT: Could not transfer artifact org.olap4j:olap4j:pom:1.2.0-SNAPSHOT from/to pentaho-third-party (http://repo.pentaho.org/artifactory/third-party/): Failed to transfer file: http://repo.pentaho.org/artifactory/third-party/org/olap4j/olap4j/1.2.0-SNAPSHOT/olap4j-1.2.0-SNAPSHOT.pom. Return code is: 503, ReasonPhrase: Service Temporarily Unavailable. -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.

Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:

[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

What should i do to fix this issue please help me out.

my pom.xml is

saiku-core

org.saiku

2.5

4.0.0

org.saiku

saiku-service

2.5

saiku – services

org.apache.maven.plugins

maven-antrun-plugin

1.2

create-package

test-compile

run

org.apache.maven.plugins

maven-compiler-plugin

2.0.2

${maven.compiler.source}

${maven.compiler.target}

UTF-8

org.apache.maven.plugins

maven-resources-plugin

2.3

UTF-8

org.olap4j

olap4j

1.2.0-SNAPSHOT

asm

asm

asm

asm-commons

retroweaver

retroweaver

retroweaver

retroweaver-rt

org.apache.poi

poi

3.7

org.apache.poi

poi-ooxml

3.7

eigenbase

eigenbase-properties

1.1.0.10924

eigenbase

eigenbase-resgen

1.3.0.11873

eigenbase

eigenbase-xom

1.3.0.11999

org.olap4j

olap4j-xmla

1.2.0-SNAPSHOT

org.jdom

jdom

1.1

org.slf4j

slf4j-log4j12

${slf4j.version}

org.slf4j

slf4j-api

${slf4j.version}

log4j

log4j

1.2.14

junit

junit

4.10

hsqldb

hsqldb

1.8.0.10

pentaho

mondrian

3.5.7

commons-lang

commons-lang

2.2

javax.servlet

javax.servlet-api

3.1.0

org.apache.commons

commons-io

1.3.2

commons-vfs

commons-vfs

1.0

Central-One

http://repo1.maven.org/maven2

Central-Two

http://uk.maven.org/maven2

Central-Three

http://mirrors.ibiblio.org/pub/mirrors/maven2

Central-Four

http://maven.antelink.com/content/repositories/central/

MY settings.xml is

uk

central

http://uk.maven.org/maven2/

*

sam
8 years ago

Hi,

Is there way to define my pom.xml to download multiple dependency plugin.

Eg: if in my pom.xml when i try to download x.y.z_version.jar in the dependencies list, it must download a.b.c_versions.jar file. Vice versa is not required. Can you provide the pom scenario for this.

Atul Prasad
9 years ago

HI MkYong,
Thanks for the article.

Is it possible to mix and match multiple repos in a single pom, ie fetch some jars from our artifactory repo, and some from local file system, for instance..

shev_lev
9 years ago

What if I need to provide username and password?

Dittmar
9 years ago
Reply to  shev_lev

See “Consuming artifacts deployed in a Bitbucket repository”
https://synergian.github.io/wagon-git/bitbucket.html

Note the “Maven 2.2.1 Workaround for HTTP Basic auth”

which I needed even I use Maven 3.2.3!

Alonso Isidoro Roman
9 years ago

Thanks Mkyong for saving my day! you are great man!

someone
9 years ago

HI MyKong ,why you dont reply to people?

Ant
2 years ago
Reply to  someone

maybe because he’s busy..

Pat Moore
11 years ago

Everytime I read your articles I feel much like your writting is improving, see it from your day one.

10288r
11 years ago

Hello, as per my project requirement, I have one war file core-web.war at my local I want to add it as a dependency or repository to my maven project & then, so all the services n classes of that war file will be available to the maven project. Please suggest the solutions …

junior
11 years ago

Hi Mkyong, am new to maven and find your site very helpful, so thank you and please don’t stop what you are doing. I wanted to find out, where can I find a list of repositories to add to my POM.xml? I have a lot of dependencies but do not know were to find the repositories for these dependencies. Any assistance will be appreciated. Thank you

kp
11 years ago
Reply to  mkyong

Hi Mkyong,

http://repo.maven.apache.org/maven2/ is disabled. By default, maven is downloading from this link. What is the alternative repository url and how to change it.

Madhu
11 years ago

Hi, I think we can also make this generic by adding it to settings.xml (under home/.m2).
Is that correct? Thanks.

Jugal Thakkar
10 years ago
Reply to  Madhu

Hello, Madhu

You can Make it generic by creating a Profile into settings.xml
see this Link from Maven Docs
http://maven.apache.org/guides/mini/guide-multiple-repositories.html

Dragon
11 years ago

Hi Mkyong,

Where is pom.xml you described is located? I cannot understand where to configure remote repos 🙁

RoarLion
9 years ago
Reply to  Dragon

it will be created when you create a standard project using maven ..

see here for details..
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

sHAILU
11 years ago

It would be better article if you would have specified the POM.XML location also. Nowhere it is mentioned!!!

Thiago Pellison
11 years ago

Thanks mkyong, it solved me a problem when deploying JBoss 5.1.0GA.

Regards,

Thiago

Pratik Jain
11 years ago

Hi Mkyong,

Superb article. I want to know where can i get all the maven remote repositories link.

Pratik Jain
11 years ago
Reply to  mkyong

This is absolutely true that “every1 is able to host a remote repository server.” but similar to Jboss application server, do we have remote repositories for other application server also. e.g. IBM Web Application Server.
Where can we search for that?

Siddhanta Kumar Pattnaik
12 years ago

Hi Mkyong,
I want to know that attribute value is java.net ,it is fixed or its any logical name,If it is fixed what is the reason behind this?

Mateen
8 years ago

Hi thanks for the tutorial