Hosting local maven repository on Local Area Network

I am using maven 3.0.5 and I want the local repository to be accessed using the following url http://local.me/localrepo/

I have an Apache web server running which already hosts an svn and I can access the svn projects using http://local.me/projects

Where I have mapped local.me to 127.0.0.1 in my hosts file.

I was wondering if I can get my maven repository online as well.

Please suggest some solution for the same.

Thanks

Answers


It is possible to setup any web server for serving a Maven repository. It really comes down to simply let the web server provide a directory on the local file system. There is no special logic involved for bare Maven repositories. All the Maven related meta-date is stored in files. The web server serves them from some directory on the web server.

Now, the tricky part is uploading content to it.

Disclaimer: I haven't tried myself yet. But ..

According to the documentation, it may simply be possible to deploy to a maven repository using a file:/ url and have the location served by a web server. There is also another possible approach described here, which uses ftp for uploading/deploying content to such a Maven repository.

However, using a repository manager (such as Nexus or Archiva) makes it easier to also manage repositories.


Unfortunately just an apache web server does not seem to be sufficient to make your repository read/WRITE available over HTTP. You need additional software, a "repository manager". There is a list of them here: http://maven.apache.org/repository-management.html

You can make a repository on the local network available over SSH. Here is how to do that. (1) In the build section of your pom:

    <!-- Make SSH wagon available.-->
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh-external</artifactId>
        </extension>
    </extensions>

(2) In your ${USER_HOME}/.m2/settings.xml (or wherever you configure repository URLs):

        <repositories>
            <repository>
                <id>my-repository</id>
                <url>scpexe://local.me/path/to/repository</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                    <checksumPolicy>fail</checksumPolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                    <checksumPolicy>fail</checksumPolicy>
                </snapshots>
            </repository>
        </repositories>

(3) In ${USER_HOME}/.m2/settings.xml, in the servers section, configure username/keys the ssh client will use:

    <server>
        <id>my-repository</id>
        <username>maven</username>
        <privateKey>/home/bob/.ssh/id_rsa</privateKey>
    </server>

This will create/use a repository (which looks like your local repository) at the path /path/to/repository on the server; it is not necessary to do anything on the server side other thank make sure this directory exists initially.


Need Your Help

jquery simpleweather not recognized

javascript jquery html yahoo-weather-api

I want to show weather on my web site using simpleweatherjs, but it is not working for me. Can somebody tell me what I'm doing wrong? Page is blank. If I, for example before line $.simpleWeather({....

How to make binding to WPF TreeView?

c# wpf xaml treeview

I have a TreeView with Binding, but in the TreeView only 1st level items are shown. I need a treeview =) I broke my head what is wrong.