Maven

http://maven.apache.org/what-is-maven.html

Maven is a unified build environment java applications and a replacement for ant. I have been using it to manage my home game development projects for a few weeks now and it is surprisingly refreshing and automates many of the little things that drive me insane when building a java project.

Things that is does that I love:

  • After specifying a dependency in the project definition (pom) maven will automatically download and link the jar into the classpath.
  • Automatic generation of project files for eclipse and intellij idea
  • Automatic running of unit tests
  • Seperation of dependencies from build time to run time
  • Test code built into it’s own jar (and excluded from release)
  • Once set up, increases the speed of the workflow.

Now, if you decide to try maven there are a few things you need to know about the dependency mechanism, the most important being that most of the game library developers don’t use maven or have little idea about it’s existance and as such many of the required dependencies won’t be found. But I have remedied this by making my own repository for game development specific jar files.

So far all that is in the repository is LWJGL as that is what I use. To add this repository and link to the definitions add these lines to your pom:


<project ...>
...
<repositories>
    <repository>
      <id>stramits</id>
      <name>stramits</name>
      <url>http://www.maven.strumpy.org</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>lwjgl</groupId>
      <artifactId>lwjgl</artifactId>
      <type>jar</type>
      <version>1.0beta</version>
    </dependency>
    <dependency>
      <groupId>lwjgl</groupId>
      <artifactId>lwjgl_util</artifactId>
      <type>jar</type>
      <version>1.0beta</version>
    </dependency>
    <dependency>
      <groupId>lwjgl</groupId>
      <artifactId>lwjgl_jinput</artifactId>
      <type>jar</type>
      <version>1.0beta</version>
    </dependency>
  </dependencies>
...
</project>

So far lwjgl is the only project in the repository, but I will be adding others at the request of the boards if they do not exist in the central maven repository.

I urge you all to give maven a go. It’s amazing for the development and build cycle. Even if you don’t end up using it it is good to know that it exists and whats it’s function is.

-Tim

I’ve been coming across more and more Maven sightings in the areas of portal development ( more work-related for me ) and have gotten to the point where I only needed a little more convincing to give it a try myself. I’ll count your message as it. :wink: Thanks for setting up LWGL for us. It may be a little while before I can try it out but I’ll let you know how it looks when I’ve had a chance.

:wink:

If you have any problems IM or email me. I’m always happy to help.

(Setting up a POM for multiple local projects can be a pain, but it’s pretty easy with a few pointers)

Thanks. ;D I just did a full reinstall of my primary Linux environment and am waiting for the Callisto release in a couple days before reinstalling Eclipse. I have learned a bit about how NOT to organize my environments in the last couple months of playing around and am looking forward to a clean slate to start on. So I may be pestering you in the near future… :wink:

Last time I looked into Maven the configuration was ridiculously complex, next to impossible to set up, and only remotely useful if you were hosting a project on Apache.org. It seemed to try to do way too much, in ways that were very specific to how Apache wanted them done or already did things. If you weren’t making an open source project, then it simply didn’t fit. At least that’s the impression I got… it was almost impossible to figure out what the heck Maven did because the documentation was so vague.

It certainly lacked the simplicity of Ant. Tell me things have gotten better… and point me to a tutorial of some sort, please.

are we talking maven 1 or 2 here?

I tried to set up maven a few months ago and got no where… mainly due to documentation issues and the like.

Things are much better now and in the long term it is much easier to maintain then ant.

The stuff I’m using is Maven 2.0, Maven 1.0 is deprecated and is way to Apache for my liking. Is there any chance you were using Maven 1.0?

There are a good list of tutorials here:
http://maven.apache.org/guides/index.html

The only real guide that you need is the “Getting started” guide. Most of the other stuff is “incase shit” guides.

I have no experience with Maven 1, but know a few people using Maven 2. They have expressed being very happy for the help it provides them in managing dependencies when multiple versions of those are available, automating unit testing in the build process, handling change logs, and providing email notifications to thier team. These are all in J2EE development environments and range from fairly simple to complex applications.

There are plugins for both Eclipse and Netbeans which are supposed to help significantly with setting up and integrating M2. Like most Apache projects there is really good info, including some Flash demos, available on their web site.

I’m sure last time I looked it was Maven 1.0… I’ll take another look… thx.