Sunday, July 06, 2008

First time to Maven

Today, I was navigating Apache.org website. I ran into the Cocoon project. Out of curiosity, I opened it. I know the project 5 years ago and I thought that it was closed (obsolete). I don't know why I always had this thought in mind, but any way. I was really amazed that the project is still open and still has activities (latest as the time of this writing is: Cocoon 2.2.0 Released on 5/15/08

Any way, while reading the documentation (Your first Cocoon application using Maven 2); I ran across this link: Maven in 5 Minutes Which lead to this link: Maven installation instructions
It's been a while since I wanted to run maven and get used to it. So, I started downloading Maven 2.0.9 immediately and began the installation instructions.
After that I went back to the Maven in 5 Minutes which made me confused about two things:
1- In the "Creating a project" section, there is the following comment:
"If you have just installed Maven, it may take a while on the first run. This is because Maven is downloading the most recent artifacts (plugin jars and other files) into your local repository. You may also need to execute the command a couple of times before it succeeds. This is because the remote server may time out before your downloads are complete. Don't worry, there are ways to fix that."
2- I created the project any way, and continued to building it. Now although the previous mentioned comment, and although I find it very strange to go through downloading all these JARs in the creation phase, it started to download the JARs again to build the project..!!

I think that it should not have downloaded extra JARs in the first place, and I think that it should not have downloaded them again.
I did not try it; but I am afraid of having to download all the JARs every time I try to build the project.
I think that this is nonsense. If Maven is requiring these JARs, I think it should be available in the downloaded file itself, if not, it would be downloaded once and for all. Or may be, added by the user himself into the lib folder or something.

Any way,...
That was just a try. May be I would explore about this more or explore the documentation section later..

Now, I'll get back to the new Cocoon.. ;)

3 comments:

Anonymous said...

Do you post about your first experience with every new tool? Or just maven because it appears as though everyone else blogs about their bad experiences with maven?

Brian said...

Maven will not redownload jars after the first time since they are stored in your local repository. Only jars actually needed during the build are downloaded, which means that list is different for every build...and changes over time as the build is maintained. It's not possible to know and bundle this ahead of time.

The comments about the timeouts need to be removed as that was with the old, unreliable ibiblio repository.

For a more thorough introduction, take a look at: Maven: The definitive guide

Mohamed El-Beltagy said...

Thanks Brian for your comment and the URL you provided. It is really a good help for me to start up.

And thank you (Anonymous) for your comment.

But I still do not understand why Maven downloads the JARs?
IMHO; I think that the JARs are separated into two types:
1- Maven required JARs: which should be included already in the downloaded bundle from Apache.
2- Project specific JARs which should be added to the classpath of the project (by any mean) and not downloaded.

If it was required to have the option to download, it would be an alternative option for using local JARs. And I think, it should not be the default option.
Thus, enhancing the user's experience.

Finally, it is still an opinion of my own and I am still excited to use it.