qqjianyue代碼工

          砌java代碼
          posts - 62, comments - 9, trackbacks - 0, articles - 10
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理
          下載appfuse2.0源碼有兩種方法

          一種是找到他的cvs下載。

          還有一種就是用maven下載,就是appfuse2.0官網上介紹的下載方法。

          好了,現在我們開始下載appfuse2.0的源碼,用第二鐘方法:

          1、下載安裝 JDK5 或以上版本。

          2、下載安裝 Mysql5.x 。

          3、建立一個本地的 stmp服務器,或者修改 mail.properties(在 src/main/resources 目錄下),使之使用另外一個不同的主機名,它默認是使用的主機名是 "localhost"。(這一步如果不是急需可以先省略,等對appfuse2.0熟悉些了再配置)
          4、下載并安裝Maven 2.0.6 。這個是必須的。有人問說不下載這個行不行?,我們build時用ant。在appfuse2.0中ant已經不推薦使用了,所以這個是必需的。
                            簡單介紹一下maven的使用,在網址http://maven.apache.org/download.html下載maven。
          在Windows 2000/XP中使用

            1. 解壓 maven-2.0.6-bin.zip到你希望安裝Maven 2.0.6的目錄下. 例如 C:\Program Files\Apache Software Foundation\maven-2.0.6
            2. 在你的環境變量path中設置maven的路徑,  在我的電腦上右鍵選屬性, 選擇 "高級" tab, 在 "環境變量" ,新建一個MAVEN_HOME  例如C:\Program Files\Apache Software Foundation\maven-2.0.6。在path中設置%MAVEN_HOME%bin; 。也可以直接在path設置. "C:\Program Files\Apache Software Foundation\maven-2.0.6\bin";%PATH%
            3. 在你的環境變量中, 確認 JAVA_HOME 設置的是你本頂的 JDK, 例如 C:\Program Files\Java\jdk1.5.0_02
            4. 打開:開始--運行--敲入cmd。在命令行 執行mvn --version ,如能正確顯示maven的版本號,說明maven安裝成功。

          如果你不喜歡用命令行的話,你也可以在eclipse創建自己的工程,你可以檢出 Candy for AppFuse 。

          下面我們就可以下載appfuse2.0了,選擇你熟悉mvc,我下載的是Struts 2 Basic,

          我在D:創建一個文件夾appfuse2-hzy,

          例如D:\appfuse2-hzy\

          在命令行中輸入 mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject

          這時maven就開始創建項目了,maven首先在C:\Documents and Settings\你的計算機用戶名\.m2\repository下載appfuse2.0所需要的jar文件,這是一個漫長的等待過程。如果你的網速極快,你可以等下去。在appfuse.java.net網站中appfuse作者已經給我們準備好appfuse2.0.m5- dependencies.zip,你只要把它解壓到C:\Documents and Settings\你的計算機用戶名\.m2\repository目錄里面maven檢測到就不用下載了。

          下面是各種配置類型maven所使用的命令:
          配置類型
              命  令
          JSF Basic     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Spring MVC Basic     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Struts 2 Basic     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Tapestry Basic     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          JSF Modular     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Spring MVC Modular     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Struts 2 Modular     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Tapestry Modular     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
          Core
          (僅后端)     mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject

          在maven執行mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject 時,如果你的mysql數據庫已經啟動了,同時root用戶的密碼為空的話,appfuse會自動在你的數據庫中生成一個myproject的數據庫,
          你的root用戶如果有密碼的話,你可以在你創建的項目的文件下的pom.xml中設置一下  <!-- Database settings -->
            root
                  添加密碼

          要運行 AppFuse 現在已經很容易了,一旦建立了項目原型,Maven會用hibernate3和dbunit的插件創建和生成數據庫?,F在你要做的就是用 Maven 運行 Jetty,然后查看你的工程。

          1、 在命令行下,cd 到你的工程目錄下,運行 mvn integration-test ,這個命令會完成相關 jar 包和 Tomcat 的下載,運行你的工程的集成測試。上面的命令大概需要5-10分鐘。
          2、在你的工程目錄下運行 mvn jetty:run-war ,你就可以去查看你的工程了。Maven 會啟動 Jetty,這樣的話,你就可以用這個地址: http://localhost:8080在你的瀏覽器中查看你的工程了。(如果你使用的是模塊化原型,你需要在你的工程的 web 目錄下運行 mvn jetty:run-war 。)
          管理員的默認用戶名/密碼為 admin/admin ,普通用戶的話,可以用 user/user 登錄。
          運行成功之后,你可能會打開appfuse的src查看源碼
          發現src\main\java\com\hzy\app只有一個App.java再也沒別的文件了,不要著急。我們接著執行如下命令mvn appfuse:full-source.現在你終于可以看到appfuse2.0的源碼了,哈哈.在項目的src\main\java\下會多出一個 org的文件,一步步進去
          你會源碼就在這里。

          劉文濤 2007-08-30 10:37 發表評論

          文章來源:http://www.aygfsteel.com/liuwentao253/archive/2007/08/30/141214.html

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


          網站導航:
           
          主站蜘蛛池模板: 台北县| 长丰县| 临洮县| 安化县| 齐河县| 手游| 巴林右旗| 寻甸| 越西县| 新巴尔虎右旗| 岱山县| 南京市| 章丘市| 涿州市| 讷河市| 成武县| 成都市| 渝中区| 江永县| 南召县| 建瓯市| 白山市| 兴安盟| 闻喜县| 神池县| 南川市| 乌拉特前旗| 苏州市| 堆龙德庆县| 都兰县| 昌乐县| 潼关县| 太湖县| 府谷县| 柘荣县| 浏阳市| 满城县| 阿拉善右旗| 淮阳县| 云龙县| 伊吾县|