qqjianyue代碼工

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

          一種是找到他的cvs下載。

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

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

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

          2、下載安裝 Mysql5.x 。

          3、建立一個本地的 stmp服務(wù)器,或者修改 mail.properties(在 src/main/resources 目錄下),使之使用另外一個不同的主機名,它默認是使用的主機名是 "localhost"。(這一步如果不是急需可以先省略,等對appfuse2.0熟悉些了再配置)
          4、下載并安裝Maven 2.0.6 。這個是必須的。有人問說不下載這個行不行?,我們build時用ant。在appfuse2.0中ant已經(jīng)不推薦使用了,所以這個是必需的。
                            簡單介紹一下maven的使用,在網(wǎng)址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. 在你的環(huán)境變量path中設(shè)置maven的路徑,  在我的電腦上右鍵選屬性, 選擇 "高級" tab, 在 "環(huán)境變量" ,新建一個MAVEN_HOME  例如C:\Program Files\Apache Software Foundation\maven-2.0.6。在path中設(shè)置%MAVEN_HOME%bin; 。也可以直接在path設(shè)置. "C:\Program Files\Apache Software Foundation\maven-2.0.6\bin";%PATH%
            3. 在你的環(huán)境變量中, 確認 JAVA_HOME 設(shè)置的是你本頂?shù)?JDK, 例如 C:\Program Files\Java\jdk1.5.0_02
            4. 打開:開始--運行--敲入cmd。在命令行 執(zhí)行mvn --version ,如能正確顯示maven的版本號,說明maven安裝成功。

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

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

          我在D:創(chuàng)建一個文件夾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就開始創(chuàng)建項目了,maven首先在C:\Documents and Settings\你的計算機用戶名\.m2\repository下載appfuse2.0所需要的jar文件,這是一個漫長的等待過程。如果你的網(wǎng)速極快,你可以等下去。在appfuse.java.net網(wǎng)站中appfuse作者已經(jīng)給我們準備好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執(zhí)行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數(shù)據(jù)庫已經(jīng)啟動了,同時root用戶的密碼為空的話,appfuse會自動在你的數(shù)據(jù)庫中生成一個myproject的數(shù)據(jù)庫,
          你的root用戶如果有密碼的話,你可以在你創(chuàng)建的項目的文件下的pom.xml中設(shè)置一下  <!-- Database settings -->
            root
                  添加密碼

          要運行 AppFuse 現(xiàn)在已經(jīng)很容易了,一旦建立了項目原型,Maven會用hibernate3和dbunit的插件創(chuàng)建和生成數(shù)據(jù)庫。現(xiàn)在你要做的就是用 Maven 運行 Jetty,然后查看你的工程。

          1、 在命令行下,cd 到你的工程目錄下,運行 mvn integration-test ,這個命令會完成相關(guān) 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查看源碼
          發(fā)現(xiàn)src\main\java\com\hzy\app只有一個App.java再也沒別的文件了,不要著急。我們接著執(zhí)行如下命令mvn appfuse:full-source.現(xiàn)在你終于可以看到appfuse2.0的源碼了,哈哈.在項目的src\main\java\下會多出一個 org的文件,一步步進去
          你會源碼就在這里。

          劉文濤 2007-08-30 10:37 發(fā)表評論

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

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 兰州市| 白银市| 甘泉县| 运城市| 万安县| 凉山| 色达县| 资溪县| 安仁县| 花莲县| 西安市| 邯郸县| 武宁县| 湘乡市| 湖南省| 宜章县| 怀远县| 陆川县| 平远县| 内黄县| 泉州市| 灌南县| 游戏| 玉门市| 丹棱县| 虎林市| 乐亭县| 云梦县| 漠河县| 周口市| 和平区| 桂东县| 乐都县| 东乌珠穆沁旗| 鲁山县| 那坡县| 思茅市| 宁夏| 淮北市| 松溪县| 钟山县|