Cheers
Tuesday, April 24, 2007
Archivia doesn't work either
Cheers
Friday, April 20, 2007
Maven 2 featuring Archiva
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