2

I have small open-source projects hosted on Github which I want to make available for others via Maven. I have a small webspace where I can host static files. How can I create a repo? Also, I would want to remove old snapshots from there if possible.

  • What do you mean by "without Nexus"? To [set up a maven repo](http://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository) you *must have* a repository management system (standard, DMSP, Proximity, Artifactory, Nexus)? – linski Apr 14 '13 at 16:22
  • Also, a *remote internal maven repository* (which is what you want to setup if I understood correctly) implementations are almost all Tomcat apps. In other words, it is impossible to host a maven repo with static web access only. – linski Apr 14 '13 at 16:34
  • Yes, I meant a static repository. Although I'm a bit confused why there is no static repository software, thanks for the answer. –  Apr 14 '13 at 16:52
  • because of the management of the artifacts. it can't be done with static web only – linski Apr 14 '13 at 17:37
  • 2
    Why don't you register an account with Sonatype and publish your project to Maven Central? That is the easiest way to make your software available: http://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide – Mark O'Connor Apr 14 '13 at 21:34
  • @Scott Mark O'Connor or carlspring's solutions are uncomparabley better than the one in my answer. – linski Apr 15 '13 at 18:37
  • @linski: You are not quite right about the fact that you cannot have an artifact repository without running Tomcat and having a proper Artifact Repository Manager such as (Nexus, Artifactory, or Archiva). You can set up an Apache httpd server with htaccess, or webdav and have Maven deploy the artifacts. That's how most people used it back in the days... (Of course that's just a storage like that, no artifact searching and so on). – carlspring Jul 03 '13 at 14:59
  • @carlspring thank you for the information. I'll update my answer accordingly in some time. – linski Jul 06 '13 at 11:16

4 Answers4

3

Standard maven repository implementations are almost all Tomcat web apps. Each one of them should have a static repository, just as your local repository. The webapp serves to the purpose of searching and management of the artifacts stored in that static repository.

If you want to host the repository with static web access only, you'll have to perform the management manually and provide a static manually generated html page that contains GAV coordinates of all artifacts in the repo. No other user but you could ever upload to the repository unless you give your password or enable anonymous FTP acces.

If maven doesn't try to upload anything to the repo until the deploy phase then this approach is still partly usable, since running a mvn clean deploy should fail.

You can check if is it doable like this (I suppose that you have that projects in your local repo):

  • upload your local repoistory folder to a URL
  • for the purpose of testing mirror your central repo to that URL
  • try to build your project with dependencies from your repo

Open your settings.xml file and under <mirrors> node add:

<mirror>
  <url>http://your/url/repo</url>
  <mirrorOf>*</mirrorOf>
</mirror>

and see if mvn clean install suceeds. Please feedback.

linski
  • 5,046
  • 3
  • 22
  • 35
2

In this SO answer I have outlined the way I set up my OSS projects which are all hosted in Github. There are actually a number of free services out there you could you when you would like to run an OSS project.

I would recommend publishing to Maven Central, if your plugin is well-tested and expected to bring other people benefits as well. You can use CloudBee's BuildHive as a free Jenkins CI.

Community
  • 1
  • 1
carlspring
  • 31,231
  • 29
  • 115
  • 197
1

A static repo works great, per my experience.

I scp'd up my local repository into a static apache server. Legit repo. Not as easy to maintain as a real repo of course, but quite a bit cheaper if you've already got a plain vanilla web host.

Other than setting the permissions properly (same as required for you to browse the folders), it was a pretty painless procedure.

The only two things I did to make it more reasonable were 1 - Wrote a script to "rm -rf ...." on most of the contents of my local repo so that the only thing I am deploying is those few artifacts that are not available in the general repos. 2 - Tarred it up first before scping to my web host.

Hope this helps.

The guy below did something similar, only using FTP which saves him a lot of hand work if he updates his binaries very often.

http://stuartsierra.com/2009/09/08/run-your-own-maven-repository

0

I think I know how to do it now. I'm using mvn deploy now to create a local repository on the file system and then I upload it to the webserver. If I'm not wrong, there doesn't even need to be a file listing.

The command I'm using is:

mvn deploy -DaltDeploymentRepository=local::default::file:./repo

This creates/updates the local repository automatically, so the repo can be synced with a server.