Unable to use Apache Archiva as Mirror - maven-2

I think this was supposed to be a simple task, but I've been unable to accomplish it.
I've set an archiva repository as this:
2 Internal Maven1 repos (old projects)
1 Internal Maven2 repo
7 Remote repos (central, java.net, jboss.org, etc.)
For each internal repo I've created a proxy connection with each remote repo.
I've added a new mirror to my settings.xml file as explained in the archiva documentation:
<mirror>
<id>archiva.default</id>
<url>http://repo.mycompany.com:8080/archiva/repository/internal/</url>
<mirrorOf>*</mirrorOf>
</mirror>
When I try building a simple project with one dependency from some of the remote repositories, no artifacts are downloaded. Why?!?
Thanks for any help.

Archiva doesn't assign repositories any special roles. You make requests to specific managed repository from Maven (so from your settings, internal), and it will serve what is in there, or proxy it from remote repositories that have been connected by a proxy connector. By default, that is just Central - adding a new remote repository has no effect until it is connected to a managed repository by a proxy connector.
What you probably want to do is add a proxy connector on the internal repo to the remote repositories in question. Consider setting the whitelist too so that it is more effecient.
You may also want to set up a repository group that spans all the managed repositories (both maven 1 and maven 2) for use from a single URL.

I had exactly the same problem with Archiva 2, for me the solution was to give the "Global Repository Observer" role to the Guest user.

Related

Added repository to Nexus but still not finding artifacts

I have a project that uses the hl7api (HAPI) available at http://hl7api.sourceforge.net/m2
In my pom I have defined a repository with this url. If I don't go via local nexus it works but when I do it will not find the artifacts. I have added a proxy repository in Nexus with the same url.
Any ideas?
If you added the repository as a proxy repository in Nexus do not forget to add the proxy to the Repository Group which you use as mirror for all Nexus requests (public/snapshot) - assumed you have this kind of configuration.
Sorry - just saw that this solution was discussed as comment on the question. Can not delete the answer but it seems to be obsolete.

Open local repository to others as a remote one

Is there any simple way,which is provided by maven itself, to open my local repo as a remote one for other users?(How cool it would be;) )
Or should I install an ftp server or apache to do it?
This is not straightforward. What you are looking to do is to set up a mirror of the repositories to be used by other users. You will be better of setting up one of the repository managers to do this.

Tomcat Nexus URL mapping for Maven POM

I'm running the maven repository manager Nexus on Tomcat. When I setup my pom file, my repository URLs all look something like http://myhost/nexus/repo-name. I'd like to get the word "nexus" out of the URL. We're currently transitioning from an older repository manager and now we need to update all of the URLs. However, if we had a generic repository URL like http://myhost/maven-repo/repo-name, then the URL would be independent of the repository manager.
How can I set something like this up on Tomcat? Would I need to setup host name aliases? Or is there an easier way to do this?
Thanks,
Jeff
I would use a frontal Apache server (only httpd, not Tomcat) to do that, configured as a reverse proxy.
Apache url rewriting and reverse proxy are easy to configure. With this Apache frontal proxy, you are independant from Nexus, but also from the Tomcat server.
With the same Apache URL, you can move to Archiva on a Glassfish server (for example) transparently for the projects.
Deploy your application in the root folder of Tomcat.
I hope you don't put repository locations into your pom's? You should use settings.xml file instead.

Failed to proxy to maven repo via Nexus

I am working with Nexus free addition (1.3.6) and I am trying to add a proxy repository as described in the Nexus book - Google Caja: http://google-caja.googlecode.com/svn/maven.
After adding a new proxy repository and configure the remote location, I tried to re-index the repository but could not see the related artifacts.
was anyone able to proxy a remote repository via Nexus and see its artifacts?
Ronen.
Well, according to the Nexus documentation about Remote Index Downloads:
Nexus ships with three important proxy
repositories for the Central Maven
Repository, Apache Snapshot
Repository, and the Codehaus Snapshot
Repository. Each of these repositories
contains thousands (or tens of
thousands) of artifacts and it would
be impractical to download the entire
contents of each. To that end, most
repositories maintain a Lucene index
which catalogs the entire contents and
provides for fast and efficient
searching. Nexus uses these remote
indexes to search for artifacts, but
we've disabled the index download as a
default setting. To download remote
indexes,
Click on Repositories under the Administration menu and change
Download Remote Indexes to true for
the three proxy repositories. You'll
need to load the dialog shown in
Figure 5.9, “Repository Configuration
Screen for a Proxy Repository” for
each of the three repositories.
Right-click on each proxy repository and select Re-index. This
will trigger Nexus to download the
remote index files.
It might take Nexus a few minutes to
download the entire index, but once
you have it, you'll be able to search
the entire contents of the Maven
repository.
Once you've enabled remote index
downloads, you still won't be able to
browse the complete contents of a
remote repository. Downloading the
remote index allows you to search for
artifacts in a repository, but until
you download those artifacts from the
remote repository they will not show
in the repository tree when you are
browsing a repository. When browsing a
repository, you will only be shown
artifacts which have been downloaded
from the remote repository.
So, to me, the proxyed remote repository has to provide a Nexus Index (which does not seem to be the case of the repository for Google Caja) to allow searching and searching is different from browsing (i.e. you'll still have to download artifacts to see them when browsing the repository). That being said, not providing an index doesn't mean the caja repository isn't proxied.

Should I use an FTP server as a maven host?

I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to server I want to host the Maven repo on.
The online repository I want to use is not hosted by myself. As I say, I only have FTP access, so if possible, I would like to use that FTP space as a Maven repository. The tools mentioned seem to work when you have full control over the host machine, or at least more than just FTP access since you need to configure the local directories where the repositories will be placed. Is this possible?
You might want to have a look at Nexus, a Maven repository manager. We've replaced our local Maven repository with a Nexus-based one and find it tremendously useful.
I've successfully used Archiva as my repository for several years ... see http://archiva.apache.org/. It's easy to administer and allows you to configure as many repositories as you need (SNAPSHOT, internal, external, etc).
According to the book "Better Builds with Maven", the most common type of repository is HTTP, this paragraph describes what I think you need:
This chapter will assume the repositories are running from http://localhost:8081/ and that artifacts are deployed to the repositories using the file system. However, it is possible to use a repository on another server with any combination of supported protocols including http, ftp, scp, sftp and more. For more information, refer to Chapter 3.
A Maven 2 repository is simply a specific directory structure, so once you get the transport and server specifications right for the repository and deployment portion of your POMs, it should be completely transparent to your users.
You can even use Dropbox. All that you need is a public address to access the files generated with mvn deploy, with any of the protocols in the accepted answer.
I guess there are more services that can work in the same way, but I'm not certain about the URL schemes that alternatives to Dropbox may use.
https://maven.apache.org/wagon/wagon-providers/wagon-ftp/ will tell you that you can use ftp to read from an existing repository, but not to create a new one. I don't think that it is impossible in principle, but no one has cared to write all the fiddly code to do the directory management via ftp.