Quick : Maven and Eclipse
Today was my first course day. Well, I just had one course in fact, the first lecture of "Open Source development". Basically, this course is about developing with Open source tools and on an Open Source project. The project should be HISP and the open source tools are Maven, Eclipse, Spring, Webworks, etc.
This first course was an introduction and a quick overview of subversion and some Java framework and tools. Well, I read a book about subversion one year ago so it was easy to understand. I prefer using git, but I don't have any choice.
The deadline of the first assignment is Friday, August 31th. It's a simple HelloWorld in Java, using Eclipse (for code) and Maven (for packaging, compile, and else). I hope I'm not going to spoil anybody, but I already done it and, well, Maven seems to be a very cool project management tool.
Getting started with Maven(2)
The first step to manage a project with Maven is to write an pom.xml file. Well, it's quite simple and well documented, and you could even generate it. I prefer write the file by hand. It something like the piece of code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
The built tree, in this example, generate a manifest file when building source and generating the jar file ; this manifest just tell that org.example.bibi.HelloWorld is the main class, the class were the public static void main(String[] args) to be launched, stands.
Working with Eclipse
The second step is to let know Eclipse the default tree needed by a Maven project. Maven need a default tree like the following.
- src |- main | |- java | | \ .. (your java source) | |- ressources
This is for the src directory. You'll have to had some source folder in Eclipse in order to let him know where are your source. And the mvn eclipse:eclipse to generate the Eclipse project files.
You can have some Eclipse-integration plug-in, in order to easily use Maven inside Eclipse, without working with a command line. That's not what I prefer but, two plugins are great : M2Eclipse and Mevenide (which is available for Eclipse, NetBeans, JBuilder and IntelliJ IDEA).
Let's rock
¶ Last update : September 2nd, 2007 at 4:27PM