开始第一个turbine项目helloworld
2006-10-23 11:40
387 查看
参考文档:http://jakarta.apache.org/turbine/meta/installation.html
参考文档:http://jakarta.apache.org/turbine/meta/getting_started.html
http://www.apache.org/dist/
一、下载Maven 1.0.2
解压maven-1.0.2.zip到硬盘上的某个目录,我把maven解压到C:/JavaSoft/maven/maven-1.0.2,配置环境变量
[Windows]+[Pause/Break]或者右击“我的电脑”,打开系统属性对话框,切换到“高级”面板,点击“环境变量”,为变量PAT
MAVEN_HOME=C:/JavaSoft/maven/maven-1.0.2
PATH=%PATH%;%MAVEN_HOME%/bin
注意:不要贪便宜下载maven-2.x,因为maven2.x和maven1.x完全不一样,而且还没有发布适合turbine的plugin。
二、为maven安装turbine的plugin
运行命令:
maven -DartifactId=maven-turbine-plugin -DgroupId=turbine -Dversion=1.3 plugin:download
注意:turbine官方文档中-Dversion的参数是1.2,为什么要改为1.3呢?原因是1.2支持的是turbine-2.3.1,而1.3支持的是turbine-2.3.2。
三、为meta提供build.properties
在你的用户主目录(Windows系统应该在C:/Documents and Settings/Administrator/)新建一个文本文件,改名为build.properties,编辑其内容为
maven.appserver.home = d:/jakarta-tomcat-5.0.28
(d:/jakarta-tomcat-5.0.28是我的tomcat的解压目录)
四、新建turbine项目helloworld
在一个合适的目录(存放项目代码C:/JavaSoft/turbine-projects),运行命令
C:/JavaSoft/turbine-projects>maven -Dturbine.app.name=helloworld turbine:setup
C:/JavaSoft/turbine-projects>cd helloworld
进入helloword目录,接着再运行命令
C:/JavaSoft/turbine-projects/helloworld>maven turbine:deploy
结果一定会出现
C:/JavaSoft/turbine-projects/helloworld>maven turbine:deploy
__ __
| // |__ _Apache__ ___
| |//| / _` / V / -_) ' / ~ intelligent projects ~
|_| |_/__,_|/_//___|_||_| v. 1.0.2
???????????????? activation-1.0.2.jar????????
???????????? activation-1.0.2.jar ??????????§°??????
???????????????? mail-1.3.3.jar????????
???????????? mail-1.3.3.jar ??????????§°??????
??????????????????????????????±??????????????¨????????????????????
activation-1.0.2.jar (try downloading from http://java.sun.com/products/javabean s/glasgow/jaf.html)
mail-1.3.3.jar (try downloading from http://java.sun.com/products/javamail/)
Total time: 7 seconds
Finished at: Mon Oct 23 11:18:07 CST 2006
别担心,之所以出现这样的错误,是因为turbine项目中所依赖的jar包从指定的下载地址中获取不到。而这个所依赖的jar包及其版本号、下载地址则保存在helloworld目录中的project.xml文件中。
根据提示错误信息,打开project.xml:
查找“activation”,修改version为1.1;
查找“mail”,修改version为1.4。
如果还有找不到的jar包,则需要访问<url></url>中所载地址,查看实际提供的版本,如果仍然失败,还可以直接去下载所需要版本的jar包,保存到C:/Documents and Settings/Administrator/.maven/repository目录下对应名称的目录中。需要注意的是jar文件的寻址方式是
C:/Documents and Settings/Administrator/.maven/repository/软件名称/jars/[artifactId]-[ version].[type]
部署成功后,运行D:/jakarta-tomcat-5.0.28/bin目录下的startup.bat启动tomcat服务,在浏览器中输入http://localhost:8080/helloworld,就可以查看你的第一个turbine项目了。
五、导入到eclipse
使用eclipse的工程导入功能,指向helloworld的目录就能够导入helloworld到eclipse了。
其实这样做远远是不够的,因为我们不仅仅需要一个集成编辑环境,更需要的是一个编辑+发布+调试的集成开发环境。没有调试或者不方便调试对我来说是完全不可以接受的,因为那样会严重影响我的工作效率。
所以找到一套调试turbine项目的方法至关重要。下次再记录我摸索的在eclipse中调试turbine的方法。
参考文档:http://jakarta.apache.org/turbine/meta/getting_started.html
http://www.apache.org/dist/
一、下载Maven 1.0.2
解压maven-1.0.2.zip到硬盘上的某个目录,我把maven解压到C:/JavaSoft/maven/maven-1.0.2,配置环境变量
[Windows]+[Pause/Break]或者右击“我的电脑”,打开系统属性对话框,切换到“高级”面板,点击“环境变量”,为变量PAT
MAVEN_HOME=C:/JavaSoft/maven/maven-1.0.2
PATH=%PATH%;%MAVEN_HOME%/bin
注意:不要贪便宜下载maven-2.x,因为maven2.x和maven1.x完全不一样,而且还没有发布适合turbine的plugin。
二、为maven安装turbine的plugin
运行命令:
maven -DartifactId=maven-turbine-plugin -DgroupId=turbine -Dversion=1.3 plugin:download
注意:turbine官方文档中-Dversion的参数是1.2,为什么要改为1.3呢?原因是1.2支持的是turbine-2.3.1,而1.3支持的是turbine-2.3.2。
三、为meta提供build.properties
在你的用户主目录(Windows系统应该在C:/Documents and Settings/Administrator/)新建一个文本文件,改名为build.properties,编辑其内容为
maven.appserver.home = d:/jakarta-tomcat-5.0.28
(d:/jakarta-tomcat-5.0.28是我的tomcat的解压目录)
四、新建turbine项目helloworld
在一个合适的目录(存放项目代码C:/JavaSoft/turbine-projects),运行命令
C:/JavaSoft/turbine-projects>maven -Dturbine.app.name=helloworld turbine:setup
C:/JavaSoft/turbine-projects>cd helloworld
进入helloword目录,接着再运行命令
C:/JavaSoft/turbine-projects/helloworld>maven turbine:deploy
结果一定会出现
C:/JavaSoft/turbine-projects/helloworld>maven turbine:deploy
__ __
| // |__ _Apache__ ___
| |//| / _` / V / -_) ' / ~ intelligent projects ~
|_| |_/__,_|/_//___|_||_| v. 1.0.2
???????????????? activation-1.0.2.jar????????
???????????? activation-1.0.2.jar ??????????§°??????
???????????????? mail-1.3.3.jar????????
???????????? mail-1.3.3.jar ??????????§°??????
??????????????????????????????±??????????????¨????????????????????
activation-1.0.2.jar (try downloading from http://java.sun.com/products/javabean s/glasgow/jaf.html)
mail-1.3.3.jar (try downloading from http://java.sun.com/products/javamail/)
Total time: 7 seconds
Finished at: Mon Oct 23 11:18:07 CST 2006
别担心,之所以出现这样的错误,是因为turbine项目中所依赖的jar包从指定的下载地址中获取不到。而这个所依赖的jar包及其版本号、下载地址则保存在helloworld目录中的project.xml文件中。
根据提示错误信息,打开project.xml:
查找“activation”,修改version为1.1;
查找“mail”,修改version为1.4。
如果还有找不到的jar包,则需要访问<url></url>中所载地址,查看实际提供的版本,如果仍然失败,还可以直接去下载所需要版本的jar包,保存到C:/Documents and Settings/Administrator/.maven/repository目录下对应名称的目录中。需要注意的是jar文件的寻址方式是
C:/Documents and Settings/Administrator/.maven/repository/软件名称/jars/[artifactId]-[ version].[type]
部署成功后,运行D:/jakarta-tomcat-5.0.28/bin目录下的startup.bat启动tomcat服务,在浏览器中输入http://localhost:8080/helloworld,就可以查看你的第一个turbine项目了。
五、导入到eclipse
maven eclipse
使用eclipse的工程导入功能,指向helloworld的目录就能够导入helloworld到eclipse了。
其实这样做远远是不够的,因为我们不仅仅需要一个集成编辑环境,更需要的是一个编辑+发布+调试的集成开发环境。没有调试或者不方便调试对我来说是完全不可以接受的,因为那样会严重影响我的工作效率。
所以找到一套调试turbine项目的方法至关重要。下次再记录我摸索的在eclipse中调试turbine的方法。
相关文章推荐
- 刚开始工作第一个项目体会
- 前端架构之路:使用Vue.js开始第一个项目
- Three20软件引擎之构建开发环境与第一个项目HelloWorld(一)
- Vue.js开始第一个项目
- AndroidStudio第一个项目HelloWorld
- 跟我开始从0学Android--从0学java--java简单介绍开始第一个java项目
- XNA 3.0初步——开始第一个XNA 3.0项目
- 越狱开发之——iOSOpenDev建立第一个越狱项目HelloWorld插件
- cocos2dx第一个游戏项目helloworld(二)
- 开始WinCE7的第一个项目——虚拟机上的CEPC
- eclipse+maven构建web项目——HelloWorld,从构建项目开始学习JavaWeb
- Cocos从入门到精通--《创建第一个项目:HelloWorld》
- 刚开始学ps,做出来了第一个项目,去掉眼镜,取前取后做个小flash
- 开始做第一个项目了。
- [SoOnPerson]使用IDEA创建第一个项目HelloWorld
- Three20软件引擎之构建开发环境与第一个项目HelloWorld
- 搭建ionic项目环境并开始第一个demo
- Cocos从入门到精通--《创建第一个项目:HelloWorld》
- 开始着手第一个Django项目
- 第一个Android项目HelloWorld