Stripes學習(一)
原文:https://blog.csdn.net/iisgirl/article/details/7479453
最近公司有一個項目要用stripes + spring(Spring JDBC)開發,用maven構建,linux(Ubuntu)係統,web服務器用websphere 6.0。
今天開始,深入淺出學習stripes,看看它優越於struts1的緣由究竟在哪裏。
備注:開發之前,請保證機器上已經安裝並且正確配置了java開發環境(jdk 5以上),maven等。
1、下載stripes的maven插件,stripes-archetype-quickstart-1.0.jar Download
2、將stripes-archetype-quickstart-1.0.jar安裝到maven本地倉庫。
- mvn install:install-file -Dfile=stripes-archetype-quickstart-1.0.jar -DgroupId=net.sourceforge -DartifactId=stripes-archetype-quickstart -Dversion=1.0 -Dpackaging=jar
3、使用stripes插件創建第一個stripes工程
- mvn archetype:generate -DarchetypeArtifactId=stripes-archetype-quickstart -DarchetypeGroupId=net.sourceforge -DarchetypeVersion=1.0 -DgroupId=tutorial -DartifactId=HelloWorld
注意:第三步的時候,如果報錯:
- Embedded error: org.apache.maven.archetype.downloader.DownloadNotFoundException:
- Requested org.apache.maven.archetypes:stripes-archetype-quickstart:jar:1.0
- download does not exist.
- Unable to download the artifact from any repository
報錯原因是.m2下缺少maven相關插件archetype。
請到這裏Download下載,然後將下載後的資源解壓,替換掉$HOME/.m2/repository/org/apache/maven這個目錄,然後再次執行,應該ok。
4、maven命令成功執行後,在$HOME(個人目錄)下會看到一個HelloWorld的工程,然後執行如下:
- cd HelloWorld
- mvn jetty:run
5、jetty成功啟動後,去瀏覽器訪問https://localhost:8080/HelloWorld
就會看到:
- Congratulations, you've set up a Stripes project!
- You are running Java version 1.6.0_24 on the Linux operating system.
這樣,我們用maven的stripes插件構建的第一工程就ok了。
6、將該工程編譯成Eclipse工程
- mvn clean install
- mvn eclipse:clean eclipse:eclipse -Dwtpversion=1.5 -DdownloadSources=true
成功執行後,就可以將該工程import到Eclipse中了。
最後更新:2017-04-03 16:48:46