Proxying and hosting a Maven repo

A common question is how can I proxy a Maven repo in my company so all developers don’t need to go out to the internet to download the same thing over and over, and having a place to put the internal private artifacts.

The answer is easier than ever. Use Archiva, it has a proxy, webdav accessible repository, search, reports,… It hasn’t been released in Apache yet but you can get a built version by downloading Mergere Maestro (don’t worry it’s open source).

You just need to add in your ~/.m2/settings.xml

<mirrors>
  <mirror>
    <url>http://localhost:8080/archiva/proxy</url&gt;
    <id>myhost.com</id>
    <name>Archiva Repository</name>
    <mirrorof >*</mirrorof>
  </mirror>
</mirrors>

Today’s picture from my Paris trip, the pyramid of Le Louvre (a scar on the face of Paris as some people say 😉 ), more pictures in flickr.

Le Louvre

The black magic inside Maven

It’s always interesting to see what your work looks from the outside, from the view of that people that you don’t know, not biased from your relationship.

I was reading  Sylvain Wallez Spring switching to Maven entry, where he exposes that Maven is too much black magic for him and prefers Ant. I think there’s a common basic mistake in his explanation, and I have already seen it in other places. If you are already an Ant user, of course it will look crystal clear after the years you have spent learning it, your opinion is also biased (not that I’m saying my opinion is not biased, that of course it is).

When talking about Ant you should also think about that first time user, that junior developer that haven’t left the IDE, and tell him that it’s easier to use Ant than Maven.

Spring is moving to Maven 2

That’s right, read Ben Hale blog entry. Now you don’t have any excuse not to use Maven 😉

For those of you who have been in despair over the last couple of
months about Spring 2.0 and Maven, you won’t be for much longer. The
Spring community has decided to incrementally convert all of the Spring
projects over to Maven. As you may know Acegi has already been using Maven for a very long time. Recently the Spring-WS project converted as well. I’ve personally prototyped Spring Web Flow’s conversion, and there is general agreement that Spring will move over as well.

In an unrelated note, if you want to have real fun, watch JavaPolis commercial.

Sun jars available on Maven repo

If you use Maven you probably already know that Sun jars were always a problem because their license didn’t allow redistribution. Now with the effort from the Glassfish project Sun is releasing a lot of components under the open source CDDL license. It allows the redistribution so we have started syncing the Maven repository at Java.net managed by the Sun guys, for now only the com.sun.* and javax.* groups and only the official releases.

Maestro and Better Builds With Maven Book 1.0.1

Today is release day, two things are out, a new version of the Better Builds with Maven book with the errata found to date fixed, and Maestro, open source end-to-end build solution based upon Apache Maven and Continuum that’s
easy to use, fast, and pre-configured for use with a high performance
repository, with commercial support available from Mergere. And yes, both the book and Maestro are free (as in free beer).

Announcements follow for more detail:

 

Mergere is pleased to announce the release of Better Builds with Maven 1.0.1, the How-to Guide for Apache Maven.

The book covers:

  • An introduction to Maven 2.0
  • Building applications with Maven
  • Creating J2EE builds
  • Plugin authoring
  • Monitoring source code, testing, dependencies and releases
  • Leveraging repositories and continuous integration in a team environment
  • Converting existing Ant builds to Maven

This latest release corrects all errata found to date. Thanks to everyone that has contributed feedback since the initial release!

Better Builds with Maven is available free of charge (after registering) from http://library.mergere.com/.


Mergere is pleased to announce the release of Maestro 1.0.1, an end-to-end build solution based upon Apache Maven and Continuum that’s easy to use, fast, and pre-configured for use with a high performance repository.

Maestro includes:

  • the Maestro Project Server for managing automated builds, project artifacts and developer sites
  • the Maestro Developer Client for building Maven projects
  • auto-configuration of developer settings from a common Project Server
  • an automated installer for Windows, Mac and Linux systems
  • comprehensive bundled documentation
  • the book “Better Builds with Maven” (v1.0.1, also available as a separate download)
  • Source code, licensed under the Apache License 2.0

Maestro is free to download and use (after registering) from http://www.mergere.com/products_developers.jsp.

There is no need to re-register if you have previously downloaded from Mergere.

Support is also available from Mergere. For more information, see http://www.mergere.com/services_core.jsp.

Maven Day – Paris

If you happen to be in Paris the 11th, from 8:30 to 12:30 there’s a free conference, Maven Day, with three core developers from Maven, Jason van Zyl, Vincent Massol and Emmanuel Venisse.

74/80 rue Roque de Fillol
Puteaux
Mo La D�fense – Esplanade

There’s a page where you can find more Maven events.

Spring and Maven relationship

Many of the Maven and Spring users out there have complained for looooong time about not having the latest Spring releases in the Maven repository at iBiblio, something that I personally solved every time there was a new release of Spring copying the jars in the repo, ensuring also that they are the official releases as it’s something used for a lot of people.

Then with Maven 2 the problem started to be the poms not being there, so as I like Spring I came with a parallel Maven 2 build that could be added to Spring CVS so we could build it with Maven 2 and thus having the right poms for Spring users. You can find this conversion in the Better Builds with Maven book, Ant to Maven migration chapter. The problem is that as new features are added into Spring, dependencies are updated,… things get out of sync pretty fast. So I kindly requested the Spring guys to add the poms to their CVS (as both Ant and Maven build can coexist) and let the community help improve them. The jira issue is SPR-1484, you can find there the latest poms i’ve been working with, and at spring/lib/readme.txt you can get the versions of dependencies used (although docs are not always up to date). If you want Spring to support the Maven 2 poms and make sure they are always up to date in sync with the releases you can vote for the issue SPR-1484.

Remember that we have now more than 11000 jars in the repo + more than 1500 project sources + more than 700 javadocs! keep doing this great job submitting them!

Maven JUG at JavaOne, plus free beer

If you happen to be in San Francisco and are interested in Maven you should check this out, there will be a Maven JUG hosted by Mergere at the W hotel, Tuesday at 7:30. You should register to make sure there’s enough space for everybody.

The official announcement follows:

 

Please join Mergere for a Java Users Group (JUG) hosted by our parent company, Simula Labs, with IBM and IONA Technologies.

This is your opportunity to hear presentations from and meet with the teams behind some of the most innovative and popular Apache open source projects today.

See how the Mergere Maestro distribution, based on Apache Maven and Continuum, provides an agile platform to build, test and manage SOA run-times, like IONA Technnologies~ Celtix. Also learn how LogicBlaze FUSE for WAS CE is an ideal middleware platform for enterprise Service-oriented Architecture (SOA).

PLUS, for early JavaOne attendees ~ see Maven founder and Chief Architect of Mergere, Jason van Zyl, speak a the closing keynote of Netbeans Day on Monday, May 15. For more information on this event, please go to: http://www.netbeans.org/community/articles/javaone/2006/nb-day.html

What: Java Users Group

When: Tuesday, May 16, 2006 from 7:30 p.m. to 9:00 p.m.

Where: The W Hotel, San Francisco
181 3rd Street
San Francisco, California 94103
(415) 777-5300
Great Room 1&2

Who: Speakers from Mergere, Simula, LogicBlaze, IBM and Iona Technologies

FREE beverages and appetizers will be served

Limited space is available ~ click the URL below to REGISTER NOW for Mergere’s JUG!

http://www.mergere.com/common/reg.jsp?form_source=m-jug_javaone2006&form_landing=m-jug_email

Optional dependencies in Maven

Colin Sampaleanu (Spring Framework, Interface21) brought again the topic about how to handle optional dependencies in Maven, what’s the best way, how to apply it,… You can read the thread How are people getting around the lack of custom scopes?. If you are too lazy and don’t want to reason you can skip to the end where you can find the solution for that problem under Maven 2.

The example he provides is Spring Webflow, currently packaged completely in an only jar, with some core dependencies always needed, some only needed when used with Spring MVC, some only with JSF, and some only with Struts.

While the idea of packaging a bunch of classes in one jar can be handy when you copy it manually I see more cons than pros:

  • Almost everybody uses a tool that will deal with several jars with no problems
  • Build time checking. If you include more classes than expected nothing prevents their use. This is a huge source of problems. My experience tells me that policies that can’t be enforced don’t succeed.
  • Component Oriented design, if you find yourself including many dependencies in your pom is like importing a lot of stuff in a java class, not a great idea.
  • With a transitive dependency tool like Maven you won’t need to add more than a few dependencies, eg depending on spring-hibernate3 automatically adds for you spring-core, spring-beans, spring-aop,…
  • In fact the Spring guys gave a step in this direction in 2.0, splitting spring-hibernate (depending on hibernate 2 and 3) into spring-hibernate2 and spring-hibernate3, or spring-orm in different jars for each ORM implementation (JDO, Toplink,…)

Here you can see as example some of the problems that I found thanks to
Maven in the Spring Framework build, that can be found in the chapter Converting existing Ant builds in the book Better Buils With Maven, that I filed in the Spring Framework issue tracker.

It’s also worth to say that Acegi Security System for Spring has been building happily with Maven 1 for far more than a year and now is switching to Maven 2. Spring Rich Client is also building now with Maven 2.

If you still are not convinced about splitting your jars in small components based on your use cases (bad for you), here is the work around in Maven:

  • Create a pom for your whole jar (spring-webflow), with all but core dependencies tagged as optional. You can build the jar with this pom.
  • Create a pom for each of the configurations, setting packaging as pom, eg spring-webflow-spring-webmvc, spring-webflow-struts, spring-webflow-jsf
  • To that poms add a dependency in spring-webflow and the required deps for that configuration
    • spring-webflow-spring-webmvc -> spring-webflow, spring-webmvc
    • spring-webflow-struts -> spring-webflow, struts
    • spring-webflow-jsf -> spring-webflow, jsf
  • In your application now you can depend on any of the projects in point #2 setting type to pom inside the dependency tag.

Hope you choose the right way and don’t go into the dark side 😉

Quieres ganar 4500 dolares por un trabajillo de verano?

No es broma, si eres estudiante Google te puede pagar 4500 d�lares, seleccionando una de las propuestas de un projecto open source y apunt�ndote a Google Summer of Code, y si superas el proceso de selecci�n durante el verano Google te paga.

He a�adido unas propuestas a la p�gina de la fundaci�n Apache, que me interesan especialmente, relacionadas con Maven, aunque tambi�n se aceptan las propuestas de estudiantes. Lee las preguntas frecuentes en la p�gina de Google y date prisa que se acaba pronto!

Adem�s tras esta experiencia est� la muy probable posibilidad de trabajar para compa��as relacionadas proyecto open source, al menos es el primer lugar donde yo voy a mirar por nueva gente. No es una mala forma de hacer el proyecto de fin de carrera, o la tesis, y conseguir una experiencia que te ayudar� a conseguir un mejor trabajo y reconocido a nivel mundial.