Search code examples
mavenpom.xmlnexus

how to set pom.xml to download artifact from nexus remote repository


I want to set a remote nexus repository with my local repository in maven, when a artifact is not in the local repository, then it should be downloaded from my remote repository and should be installed to the local repository. How can I set it?


Solution

  • You have to add a repository section to your pom.

    Here is an example:

    <repositories>
        <repository>
            <id>browserid-snapshots</id>
            <name>browserid-snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>
    

    Taken from here https://github.com/user454322/browserid-verifier/blob/e7b81495882312c8cd9f1fb7e8313e239a6b3238/sample/pom.xml#L67-L73


    Check the Repository section on the POM Reference for more info.