In today's programming culture it's essential to know some more stuffs apart from the language you code with. I learned the importance of this insight as I was flipping through the book 'Well Grounded Java Developer' . I've come across the title of this book several times only to overlook it meaning in depth, murmuring 'Ha! another book for java newbie'. But it turned out that I was totally wrong and it taught me a lot about programming (including Java) and other things like test drivent development, build and continuous integration (maven) etc. All these were the buzz terms I've been hearing a lot for the last one year but left unlearned so far. The WGJD was an awesome start-off.
Maven, is one concept I got wrong from the beginning, we've bee using it at our work place as an eclipse plugin for around a year now and I was under the notion that it's 'just a plugin'. Later from the book I understood, maven is a continuous integration tool that's initially run as an application itself via command line and once you get familiar with the cmd usage, you catch up easier with the maven plugins written for IDEs. Below are the ice-breaker steps to get maven running on your windows machine.
Environment
- Operating System : Windows 7 64 bit
- Java 1.7 installed and path configured in environment variables
Steps To Install Maven In Windows
2. Extract it to C:\
Note: As in many Java/JVM-related software installations, it pays to not
install Maven into a directory with spaces in its name, because you might
get PATH and CLASSPATH errors. For example, if you're using a MS Windows
operating system, don't install Maven into a directory that looks like C:\Program
Files\Maven\.
3. Add the M2_HOME For Windows-based operating systems, you'll add something like this:
M2_HOME=C:\apache-maven-3.0.3
4. Maven needs the Java JDK to run. Any version greater than 1.5 is fine. You'll also need to make sure that your JAVA_HOME environment variable is set—this has probably already been set if you have Java installed. You'll also need to be able to execute Maven-related commands from anywhere in your command line, so you should set the M2_HOME/bin directory to be in your PATH
5. Take the cmd :
For Windows-based operating systems, you'll need to add this:
PATH=%PATH%;%M2_HOME%\bin
Note that the above lines have to be entered every time when u start cmd to run maven. The best way is to add the property directly in the PATH field in My Computer (Righ Click) > Properties> Choose Advanced Tab > Environment Variable.
You can now execute Maven (mvn) with its -version parameter to make sure the basic
install has worked.
mvn -version
Why Should I use Maven ?
Previously, in java projects, when we required the apis from another framework we used to download the jar files from their respective websites and add it to the lib folder in the java project. This is tiresome process, sometimes your newly downloaded jar will have some dependency and need jar's from some other projects to work well. Maven simply automate the major portion of this task by using a pom.xml file. In the pom.xml file you can just specify the name and version of jar files and maven will fetch the same and it's dependencies from the repository. This is the crux of java but there is a lot more you can do from here.
You can refer the book Well Grounded Java Developer from Manning to learn more about building your project from the pom.xml and doing several other operations.
1. Installing Maven - Mkyong.com
2. Mavens Official Website
3. The Well Grounded Java Developer ( affiliate link )
Resources
1. Installing Maven - Mkyong.com
2. Mavens Official Website
3. The Well Grounded Java Developer ( affiliate link )
Comments
Post a Comment