Jump to content

Recommended Posts

Posted

This guide will guide you through about the way to setup your serverpack inside eclipse whether it uses ant or maven project management tools.

 

Lets go over the compiling briefly(not going to speak about the setup in this one).

 

L2Jserver and their forks doesnt need any special setup, its ready to go from the beginning, you just checkout the source run the ant script and your done theres really nothing more to it.

 

Altho if it comes to maven its a bit more tricky. 1st of all you checkout their project like usual, than you have to convert each project that contains a pom.xml(equivalent of build.xml) into a maven project. Thats necessary for the classpath to detect your libs and your source folders. When thats done all you have to do is use the maven clean and install commands the same way you would use run as. Maven install will run the compile script and going to build your project, clean will delete your compiled source.

 

Now lets see Ant vs Maven in some specific areas.

 

Library management:

 

Ant have to have the librarys stored inside your workspace to use them and you need to edit the classpath manually for each of them. The adventage of that is you can exclude some of the not necessary librarys such as mysql connector for example from the classpath.

 

Maven on the other hand uses its own local repository to fetch librarys that you set as dependencys for a project. The adventage of that is that if you attach a project to another, for example gameserver project attached to the datapack project, the datapack project will inherit automatically every library that the gameserver uses. Also maven since it doesnt requires you to store librarys in your workspace you have a much easier way updating your current librarys(you change a version number and done), and adding new librarys(you can just look up thousands of librarys from maven central which is the main maven repository that contains everything you need).

 

Project management with the use of them:

 

Ant have no plugin management at all, so you have to use basically custom commands to get to something you want. In many cases you doesnt really need anything special that depends on your needs tho.

 

Maven on the other hand have an extensive amount of built in plugins that you can use. You can generate a report from an issue tracker, generate a site for the project on compile, generate javadocs on compile(usefull if your project is really documented), you can generate various project reports, run JUnit tests in several ways and many more.

 

finally to that i would to paste here an article from a blogger i used to read sometimes named Cristoph.

 

Oh boy, how this bothers me. The endless debate and religious battle about which build tool is the better build tool, no, is the one and only right build tool...

 

There are many people out there who love Ant, who defend Ant with their blood and honour. That's fine, but some of them at the same time shoot at Maven. There is so much rant about Maven, so much unfair allegation and just plain wrong claims. This is just one example that has been discussed in the community lately.

 

Don't get me wrong. Maven has its flaws and issues, sure, and you don't have to like it. Use Ant, or Gradle, or Buildr, or Schmant, or batch files, or anything else if you like that more. But, Maven definitely can be used to build complex software projects, and lots of people are doing exactly that; and guess what -- some of them even like this tool... So, can everybody just please use what he or she likes the most for building their software, and stop throwing mud at each other? Let's get back to work. Let's put our effort in building good software.

 

We've Come a Long Way...

You may have guessed, I think Maven is the best build tool, at least for the type of projects I am dealing with in my company. We have started using a complex system of mutual calling batch files long time ago, and switched to Ant in 2000. That was a huge step ahead, but still it was a complex system with lots of Ant-Scripts on different levels. So we moved to Maven 1.0.2 in 2004 for another project. That brought nice configuration and reporting features, but still did not feel right, especially for multi-module projects that were not supported in the Maven core at that time.

 

When Maven 2 came out, we adopted that early and suffered from many teething troubles, but nevertheless we were sure to be on the right track. Today, Maven is a mature, stable, convenient build tool for all our projects, and the first time we are quite happy with how it works and what it provides. Moreover, it sound really great what the brave guys from Sonatype have in their pipeline: Maven 3, Tycho, and all those nice tools like Nexus and m2eclipse...

 

Hence, I am happy and honestly don't really care very much about what the blogosphere is telling about Maven. But the sad thing is, my colleagues (mostly used to Ant build systems) are complaining with the same weird theses about Maven. I'll give you one example.

 

The Inhouse Battle

In my current project, we create EJBs in some JARs and assemble an EAR file for the whole application. Now we have to create another RAR to be put in the EAR, so I setup a new project (following Maven's convention "one project, one artifact") for the RAR. This is what the "Ant guys" didn't like: "Why can't Maven create that RAR within the main project, you know Ant could do that, so maybe we should use Ant here again, why have so many small projects, this is polluting our Eclipse's Project View, so much complexity, Maven sucks, I knew that before, blah blah..."

 

Well, I tried to explain that Maven of course can be configured to create multiple artifacts per project, but that's not the recommended way because it violates Maven convention. It's all about modularity and standardization. That is how Maven works, and it's great this way. A small project is not much overhead at all, it is going to have a clean and simple POM, and by the way we discovered a dependency cycle in the code that had to be fixed in order to move the RAR code into a separate module.

 

So, what's wrong with Maven? Is it just that you want to do it your way and not to subordinate the Maven way? A matter of honor and ego? Is that enough to kick out Maven and go back to your Ant and script based build system (which BTW is so complex that only few guys really know how it works)? Come on.

 

The Bottom Line

IMHO, standardization of build systems is one of the main benefits that Maven brought to the world. If you know one Maven project, you can switch to any other project built with Maven and feel comfortable immediately. This increases productivity, both personally and for your company, which is one of the reasons more and more companies switch over from Ant to Maven.

We have clean conventions, a nice project structure, and a highly modular system. And, we have world class reporting with minimal effort.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...