artaxerxe
artaxerxe

Reputation: 6411

Install remote maven artifact to local repository

I would like to install an artifact from maven central repository to my local repository. Can anyone help me on getting this? With other words, I want some jars from maven central repositories to be downloaded into my local repository, but using maven, not going in browser and downloading needed jar files.

Upvotes: 1

Views: 557

Answers (1)

Deltharis
Deltharis

Reputation: 2373

I am not entirely sure why would you want artifacts from maven for reasons other than using them in a maven based project... But since that's what you want:

Maven installs artifacts locally when they are used - that is when you install a project that has them in dependencies. Therefore the simplest solution would be to create a dummy project, put the artifacts you want as dependencies and install it. Something like:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>dummy</groupId>
    <artifactId>dummy</artifactId>
    <version>dummy</version>

    <dependencies>

        <-- artifacts you want -->

    </dependencies>


</project>

within pom.xml file in an empty folder. It will additionally create a dummy artifact in your local repository you might want to get rid of manually if it bothers you.

Upvotes: 2

Related Questions