安装: Windows 2000/XP Unzip the distribution archive, i.e. apache-maven-2.0.10-bin.zip to the directory you wish to install Maven 2.0.10. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-2.0.10 will be created from the archive. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-2.0.10. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven < 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed. 1.查看版本信息: shell> mvn -version 如果是校园网,首先要配置代理:M2_HOME/conf/settings.xml中(使用私服的时候,也是在settings里面配置代理,nexus中的Server也有可能配置代理 试试看) 2.用maven建立简单的java项目框架: shell> mvn archetype:create -DgroupId=cn.edu.sdau.neat -DartifactId=mvnproject 3.用maven建立简单的web-app项目: shell> mvn archetype:create -DgroupId=cn.edu.sdau.neat -DartifactId=web-app -DarchetypeArtifactId=maven-archetype-webapp 4.将mvn建立的项目转为Eclipse项目: 首次在Eclipse中使用maven2库,先要: shell> mvn -Declipse.workspace=/path/to/your/eclipse/workspace eclipse:add-maven-repo shell> mvn eclipse:eclipse 打开eclipse导入该项目,并建立src/main/java源程序文件夹 5.在pom.xml中配置下载jar包 例如:servlet包: javax.servlet servlet-api 2.5