On 1/12/06, Pablo Muñiz García <[EMAIL PROTECTED]> wrote:
>
> Hi all!
>
> Lately I've been trying to find an alternative to codehaus
> *maven*-proxy that work with *maven* 2. After some "Googling" *maven*-*
> proxy.rb*
> (an script wirtten in Ruby) appeared. I've followed instructions
> detailed in the script, but I haven't been able to get it work under
> Apache.
> Anyone has experience on working with this project? Any success story?
> Maybe an alternative?
>
> Thanks in advance!!
>
> Greetings, Pablo.
I successfully got maven-proxy.rb running, at least for my uses. I'm an m2
newbie and just learning, so I don't do anything fancy yet. Not sure if this
the best way, but this is how I did it.
I had an Ubuntu box with Ruby already installed that I wanted to use as our
internal repository. I put maven-proxy.rb in /usr/lib/cgi-bin and edited the
configuration section like this:
# ==== Configuration section ====
LOCAL = '/var/maven-repos'
REMOTE = %w{http://www.ibiblio.org/maven2}
ALIAS = '/maven'
MIME_TYPES = '/etc/mime.types'
LOG_FILE = '/var/log/maven-proxy/maven-proxy.log'
Then I edited /etc/apache2/sites-enabled/000-default and added this section
just before the end:
Alias /maven/ "/var/maven-repos/"
Alias /maven2/ "/var/maven-repos/"
<Directory "/var/maven-repos/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Allow from all
Order allow,deny
RewriteEngine on
RewriteBase /maven/
# Always defer to cgi when query string == 'refetch'
RewriteCond %{QUERY_STRING} ^refetch$
RewriteRule ^(.*)$ /cgi-bin/maven-proxy.rb/$1 [QSA,L]
# Defer to cgi for missing files and directories
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /cgi-bin/maven-proxy.rb/$1 [QSA,L]
</Directory>
and modified the ScriptAlias section like this:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler cgi-script .rb
Order allow,deny
Allow from all
</Directory>
I then created the /var/maven-repos/ directory. You'll need to make this
directory writable from apache, which for Ubuntu is www-data I believe.
Then I restarted apache. I had some problems initially with file
permissions. I had to make /var/maven-repos world-writable, though I
probably just needed it writable by www-data. I also had permissions
problems on the /var/log/maven-proxy/maven-proxy.log
The ruby script would give some funky errors when it had permissions
problems. I had to add some logging to figure out that was the root cause.
Watch the log file for any helpful info.
I also thought it wasn't working because I tried to "browse" it from a
browser and it didn't do anything, but once I tried to do some stuff from
mvn then it started populating and I could browse the local repo through the
browser.
The above was actually done in several steps and through some trial and
error. I'll try to help any way I can.
good luck,
Logan Allred