4
Tutorial 1 – Java, Maven and Eclipse
This tutorial will guide you through building a simple Java application from
scratch using popular tools like eclipse and maven. This tutorial will be handy
for those who are new to maven/eclipse/Java.
Install the following programs. In this tutorial I have installed them under c:/java.
Java 1.5 (JDK1.5 & JRE1.5)
site: http://java.sun.com/javase/downloads/index_jdk5.jsp
. . Also set the environment
properties JAVA_HOME (e.g. C:\java\jdk1.5.0) and add to the path (e.g.
%JAVA_HOME%\bin). If installed correctly you should be able to test it by opening a
command prompt and typing
C:\>java –version
Results in:
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
Maven 2.0.7. Site: http://maven.apache.org/download.html. Set the environment
variables M2_HOME (e.g. C:\java\maven-2.0.7) and add to the path (e.g.
%M2_HOME%\bin). If installed correctly you should be able to test it by opening a
command prompt and typing:
C:\>mvn --version
Results in:
Maven version: 2.0.7
Java version: 1.5.0_11
OS name: "windows xp" version: "5.1" arch: "x86"
Open the “settings.xml” file under C:\java\maven-2.0.7\conf folder and set your
local repository as follows:
<localRepository>C:/java/.m2/repository</localRepository>
Also if your internet access is through a proxy server then configure your proxy server
in “settings.xml” for example:
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>webproxy</host>
<port>8080</port>
<nonProxyHosts>local.net,some.host.com</nonProxyHosts>
</proxy>
Eclipse 3.3.0 (Europa). Site: http://www.eclipse.org/downloads/
So far we have installed the programs under c:/java. Now we need to create a folder for
our tutorials as c:/tutorials. Also create an eclipse workspace “C:\java\eclipse-tutorial-
评论3
最新资源