3.1 Downloading Maven and compiling the examples
3.1 下载Maven并编译实例源码
Here are the steps to download and install Maven:
1 Download Maven from the Apache Software Foundation: http://maven.
apache.org/.
Maven is provided in both tarball and zip format, depending on your operating
system.
2 Expand the downloaded archive to a permanent location on your computer.
3 Create an environment variable named M2_HOME that points to the Maven
directory.
4 On Unix, add the $M2_HOME/bin directory to the PATH environment variable
(on Windows, add the %M2_HOME%\bin directory to the %PATH% environment
variable).
5 Verify the Maven installation by running the following command from the command
line:
$ mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 13:16:01-0600)
Java version: 1.5.0_19
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/
Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.2" arch: "i386" Family: "unix"
下面是下载和安装Maven的步骤:
1. 从Apache Software Foundation下载Maven:http://maven.apache.org/.
2. 解压下载的压缩文件到本地一个目录.
3. 创建环境变量M2_HOME指向Maven的目录
4. 如果使用Unix系统,需要添加$M2_HOME/bin目录到PATH环境变量(
windows系统,添加%M2_HOME%\bin到%PATH%环境变量).
5. 使用下面的命令行命令,检查Maven的安装是否成功:
mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 13:16:01-0600)
Java version: 1.5.0_19
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/
Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.2" arch: "i386" Family: "unix"
You should see similar output which indicates that Maven is properly installed.
If you don’t see similar output, you’ll need to rectify this before proceeding. See
the Maven installation instructions for more information: http://
maven.apache.org/download.html#Installation.
输入命令mvn -version后,你应该看到类似的指示Maven已经成功安装的输出信息.如果没
看到类似的输出信息,你需要正确安装Maven然后再继续下面的内.参考Maven安装知道,以
获取更多信息.
YOU NEED AN INTERNET CONNECTION To use the examples in this book, you’ll
need a broadband connection to the Internet. This is so that Maven can
download the necessary dependencies for the examples.
要使用本书的例子,你还需要因特网的宽带连接.因为Maven需要下载必要依赖包.
If you’ve successfully installed Maven, the examples need to be unzipped and compiled.
After expanding the zip file containing the example source code, you’ll be ready
to compile the examples. To do so, move into the amq-in-action-example-src directory
and run the command shown next. For the convenience of recognizing the actual
command apart from the rest of the output, the command itself is listed in bold.
如果你已经成功安装Maven,可以解压和编译本书实例.解压zip文件,得到实例的源代码后即可编译.
为此,在命令行中进入amq-in-action-example-src目录,执行下面的命令.为了区分命令本身和命令的
输出,命令字符以粗体字显示.
[amq-in-action-example-src] $ mvn clean install
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
-----
[INFO] Building ActiveMQ in Action Examples
[INFO] task-segment: [clean, install]
[INFO] -------------------------------------------------------------------
-----
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/
maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
3K downloaded (maven-clean-plugin-2.2.pom)
...
[INFO] [install:install {execution: default-install}]
[INFO] Installing /private/tmp/amq-in-action-example-src/target/
activemq-in-action-examples.jar to /Users/bsnyder/.m2/repository/org/
apache/activemq/book/activemq-in-action-examples/1.0-SNAPSHOT/
activemq-in-action-examples-1.0-SNAPSHOT.jar
[INFO] Installing /private/tmp/amq-in-action-example-src/target/
activemq-in-action-examples-src.zip to /Users/bsnyder/.m2/repository/org/
apache/activemq/book/activemq-in-action-examples/1.0-SNAPSHOT/
activemq-in-action-examples-1.0-SNAPSHOT-src.zip
[INFO] -------------------------------------------------------------------
-----
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------
-----
[INFO] Total time: 57 seconds
[INFO] Finished at: Fri Dec 04 22:35:57 MST 2009
[INFO] Final Memory: 24M/44M
[INFO] -------------------------------------------------------------------
-----
Much of the output from the compilation of the examples has been elided for brevity.
Suffice it to say that this output represents a successful compilation. As long as you see
the BUILD SUCCESSFUL message, you’re ready to move on to the next section. If, on
the other hand, you see the BUILD FAILURE message, you’ll need to troubleshoot and
correct the situation before proceeding.
为简单起见,大部分编译时的输出都被省略了.类似上面的输出来自一个成功的编译.只要你看到
BUILD SUCCESSFUL,你可以继续看下一节内容.如果看到BUILD FAILURE,你需要找出编译失败的
原因然后再继续下一章节.
译注: 关于本书的源码及其编译,请看: http://jackyin5918.iteye.com/blog/1945209
相关推荐
maven3.1、maven3.2 ,及maven与eclipse整合插件,包含3.2的源码
Maven 是一个项目管理和构建自动化工具
通过maven项目中的pom文件进行编译jar包。资源包包括maven3 和编译所需工具。
apache-maven-3.5.0 文件附源码
Spring与ActiveMQ完整实例源码下载 Maven 版。 Spring与ActiveMQ完整实例整合源码,maven版本可以直接运行 百度云下载 SpringActiveMQ源码百度云下载
最新maven视频教程加源码笔记,内容完整有保证,是学习maven的不可多得的教程。
Maven是一个采用纯Java编写的开源项目管理工具。Maven是很重要的,我们可以对我们所编写的代码进行预编译。
自己学习并应用Spark一段时间后,由于需要改源代码,就研究了下怎么编译源码,成功编译后,记录下了编译的步骤和遇到的问题,例如编译过程中,下载大量的依赖包,默认从国外下载,非常慢,可能要编译好几个小时,...
编译Hadoop源码需要的maven文件,编译Hadoop源码需要的maven文件.
Maven是一个采用纯Java编写的开 源项目管理工具。Maven采用了一种被称之为project object model (POM)概念来管理项目,所有的项目配置信息都被定义在一个叫做P
maven的jar包跟源码包 apache-maven-3.5.2-bin&apache;-maven-3.5.2-src
maven整合spring,最简单的测试案例。
所有用Maven管理的真实的项目都应该是分模块的,每个模块都对应着一个pom.xml。它们之间通过继承和聚合(也称作多模块,multi-module)相互关联。 提供了一个简单的Maven多模块实例
ssm框架结合maven整合web项目源码,
Spring-Framework-5.2.x源码maven版本,剔除了spring-aspects模块,下载后导入idea依赖完以后就可以愉快的调试spring源码了,转换不易谢谢
maven3.1
ssm+maven项目管理系统源码 初学者适用 使用eclipse调试
之前用maven开发,每修改一次代码都需要重新编译发布一次,于是后面我用了jrebel实现热编译,这样开发就方便了很多,后面开发都只需要编译一次,有代码或者页面改动,都会自动去编译,不用maven再重新编译发布一次,...
apache-maven3.1版本。老牌版本,需要的同志可以下载,只为赚点积分。。
SpringMVC+Mybatis+Maven搭建实例以及Mybatis-Generator工具类