rethink

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            11 隨筆 :: 0 文章 :: 16 評論 :: 0 Trackbacks

          一、準備工作

              1、下載appfuse-dependencies-2.0.2.zipappfuse-documentation-2.0.2.pdf

              https://appfuse.dev.java.net/servlets/ProjectDocumentList?folderID=9173&expandFolder=9173&folderID=4695

                 下載apache-maven-2.0.9-bin.zip

              http://maven.apache.org/download.html

           

              2、配置環境變量JAVA_HOMEJDK 5+)、MAVEN_HOME2.0.9+),安裝MySQL 5.x數據庫。

          二、構建官方指南

              1、為了加快構建時間,可以提前下載相應的軟件。除了appfuse-dependencies-2.0.2.zip外,還需要下載apache-tomcat-6.0.14.zip

              appfuse-dependencies-2.0.2.zip解壓到C:\Documents and Settings\Administrator\.m2\repository

              apache-tomcat-6.0.14.zip拷貝到C:\Documents and Settings\Administrator\Local Settings\Temp\cargo\installs

              2、開始構建,建立目錄appfuse,在命令窗口進入到目錄中,執行C:\appfuse>mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject  運行此命令是為了構建基于struts2appfuse項目。在appfuse目錄下生成myproject目錄及相關文件。

          然后在確認通過用戶名為root、密碼為空進入mysql的情況下,執行:C:\appfuse\myproject>mvn  運行此命令會完成相關 jar 包和 Tomcat 的下載,并運行工程的集成測試。

          最后可以通過執行C:\appfuse\myproject>mvn jetty:run-war ,你就可以去查看你的工程了。用這個地址:http://localhost:8080在你的瀏覽器中查看你的工程,管理員的默認用戶名/密碼為 admin/admin ,普通用戶的話,可以用 user/user 登錄。

              3、通過執行C:\appfuse\myproject>mvn appfuse:full-source可以看到appfuse2.0的源碼,通過執行C:\appfuse\myproject>mvn可以建立適合eclipse環境的工程,不過直接導入工程文件后會有很多地方報錯,需要在eclipse中重新配置后才可以使用。

          三、構建自己的工程

              1、創建工程(基于struts2

          C:\appfuse>mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject

              2、修改數據庫相關信息(我用的是sql server),進入myproject打開pom.xml文件,在文件底部修改數據庫信息。并修改genericCore屬性為false(若生成daoservice等類需要修改此屬性)。

              3、由于有現成的數據庫所以直接生成實體類,執行:mvn appfuse:gen-model命令,在myproject\src\com\mycompany\app\model下生成了相應的文件。

              4、生成daoservice等類,執行:mvn appfuse:gen -Dentity=pojoName。雖然daoservice等類都生成了,但在構建時報了些信息但并沒有標明是錯誤:

          [INFO] [appfuse:gen]

          Property 'http://apache.org/xml/features/nonvalidating/load-external-dtd' is not recognized.

          org.xml.sax.SAXNotRecognizedException: Property 'http://apache.org/xml/features/

          nonvalidating/load-external-dtd' is not recognized. at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.getProperty(AbstractSAXParser.java:2060)

          貌似解析xml時出現了不認可的屬性。根據http://www.nabble.com/errors-with-appfuse:gen-td17424029s2369.html說明,可能以后使用中會出現其他錯誤,建議使用appfuse2.0.1版本。

          posted on 2008-05-30 17:04 rethink 閱讀(4943) 評論(4)  編輯  收藏

          評論

          # re: appfuse學習(一) 2008-12-24 21:42 javafox
          就這樣沒了啊?還有沒有  回復  更多評論
            

          # re: appfuse學習(一) 2009-01-22 19:00 xx
          學習一下  回復  更多評論
            

          # re: appfuse學習(一) 2009-03-25 15:35 路人
          中國現在缺少能把事情說清楚的巨匠. 你的文筆不敢恭維,不過不用擔心,中國大部份人寫的東西都是這樣的.  回復  更多評論
            

          # re: appfuse學習(一) 2009-08-26 21:02 悟空西游
          @路人
          能寫出來已經不錯,不能要求太高!  回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 来宾市| 宁明县| 桦南县| 寿光市| 张家口市| 遵义市| 普兰店市| 石狮市| 聂拉木县| 察哈| 太谷县| 承德市| 新乐市| 岗巴县| 宁强县| 万山特区| 阿坝| 哈密市| 枝江市| 安阳县| 射阳县| 吴桥县| 郴州市| 柘荣县| 桓仁| 芷江| 德昌县| 保定市| 得荣县| 寿阳县| 郸城县| 腾冲县| 彩票| 汝城县| 小金县| 阳原县| 大同市| 额尔古纳市| 广东省| 临清市| 梅州市|