Showing posts with label Archivia. Show all posts
Showing posts with label Archivia. Show all posts

Tuesday, April 24, 2007

Archivia doesn't work either

In my last post I tried to find a solution to learn maven to skip external, public repositories e.g. Ibiblio/repo1 if I invoke any maven-commands and only check the local and the internal maven-proxy. First I thought Archiva was the solution for my problem but I was wrong. Archiva will also behave like Mave-Proxy if I configure any remote repositories over Archivia's web-interface.

So, I kept researching and after a while I found another maven-proxy called Artifactory. As I read the description I recognized the fact that Artifactory is a complete rewrite of the old Maven-Proxy with many new features. For a detailed overview please check out Artifactory's official website.

So, filled with new hope I installed Artifactory and after a few configuration-troubles maven and this new proxy worked fine, but to my regret the feature I would like have also didn't work so I decided to write a mail to Artifactory's lead-developer and hope he will have a solution for my problem.

In spite of everything I would like to mention the cool Ajax-based feature of Artifactory's repository-browser and pom-preview. The following picutres shows the login, the browser, a right click on a pom-file and the preview.


From Maven


From Maven


From Maven


From Maven


I also found a thread on Nabble where two workarounds are described but both of them didn't work with my environment. So please, if you have any ideas let me know! *help*


Cheers

Friday, April 20, 2007

Maven 2 featuring Archiva

The last days I spent some time on finding a solution to help the developers at my office, to get their build process faster. All the developers (still) use Maven 2.0.4 as their build-tool and Maven-Proxy as their internal office repository. But what is the concrete problem now. So far everything sounds pretty easy to understand and you might aks yourself why there are any problems. If you have already some experience on how to use Maven in combination with an internal Maven-poxy for your build process then you know of course how maven's build lifecycle works. If not please check out the description on the maven's main homepage.

But what is the problem? Everytime a developer invokes some maven commands, maven checks if there are any new versions of the used artefacts. First maven checks the local, then the internal proxy and then all of the configured external repositories. But how can you configure maven only to check the local and internal maven-proxy and to skip all the external check? So I decided to configure a local configuration of the same environment we use at work with a little difference: I use maven 2.0.6 and the Archivia proxy.

I configured my old local ./m2 repository which I used with maven 2.0.4 at work as my internal (but don't muddle up the local repository with the internal one) repository and created a new local repository on my C drive which i called "M2_Local". So if you are a bit confused now have a look at the following drawing.

From Maven


By the way you can configure all these changes in the settings.xml of your Maven installation. I will explain this changes more in detail later in this post. If you set up your Archivia-proxy successfully then you will be able to add some repositories which should be monitored by the server.


From Maven

Now, back to the actual problem. So, if a developer invokes e.g. a mvn install then Maven checks every artefact if there is a new version somewhere on the web. But what if the developer knows that there aren't any updates and just would like Maven only to use the internal office-proxy. Of course I know the -o (offline-mode) option for Maven but this also will skip the internal proxy. Why should a developer want to skip the external repositories anyway?

If you have a very huge business module which is devided in many, many submodules and e.g. the Maven core-developer do some restructering work on the public repositories at same time as you work, then it's possible that even a simple mvn clean command can take very, very long (~20 min) because the online-checks of Maven are extremly slow. So what can we do something to stop Maven doing this online-update-checks?

My first idea was to configure the maven-proxy (in my case Archivia) also as external repository in the settings.xml. You just have to set the id of one repository to 'central'. Now Maven won't check other external repositories except the configured one.


From Maven


So if your project needs some artefacts which aren't already in your local or internal proxy repository, the build will fail because Maven doesn't check the public repositories e.g. repo1 or Ibiblio. Here you can see the BUILD FAILURE and the configured remote repositories.

From Maven

If you would like to receive updates again, just uncomment the 'central' configuration or rename the id to any other name than 'central'. In fact this is the bahaviour I'd like to have. The problem is, that the maven-proxy (Maven-Proxy not Archivia) will still check the remote repositories for updates. I think that's because you can set this configuration in some property file of the Proxy. The following code-snipped is from the Maven 2.0.4 which we use at work:

From Maven

As you can see, the id 'central' has also been set but Maven still checks the public repositories. *confused* The following picture shows that indeed Maven checks the internal maven-proxy but stills receives data from repo1 or Ibiblio.

From Maven

I also checked if there isn't the artifact I'd like to receive on any public server by changing the version number of the artefact to an ivalid one. Maven prints out the following set up remote repositories:


From Maven

So it must be a Mave-Proxy specifig configuration. I don't have a better explanation but I'll keep on researching that problem. Maybe also Archivia will behave like this if I set up remote repositories over the Archivia's web-interface.

But I will write more about my experiences and if I have found a solution in later posts. Maybe there is a simple Maven-setting for this problem which I haven't found yet. You are welcome to post some better solution for this problem.

Cheers