OpenBravo 在eclipse下項目建立

 
OpenBravo 在eclipse下項目建立
介紹
Openbravo 現在完全可以在 eclipse 環境下開發,測試,部署, 包括 4 個項目 openbravo core , trl wad 在相應目錄下都有 eclipse 的項目文件, 項目可以直接導入到 eclipse
環境需求
·        Apache Tomcat 5.5 .
·        Apache Ant 1.6 .
開發工具
·        Subversion  Eclipse IDE 插件 Subversive or Subclipse .
這個插件可以不安裝。 可以選擇安裝 TortoiseSVN-1.4.5.10425-win32-svn-1.4.5.msi http://tortoisesvn.net/downloads 下載。
建議安裝這個軟件用來下載代碼,因爲整個代碼比較大,下載時間很長。
 
Eclipse設置
如果你使用插件來下載代碼,請參照這個文檔的這個部分
關聯 *.xsql 文件到編輯器,也可以參照上面的文檔,這個也可以先不做。
 
SVN 上下載代碼
Openbravo Subversion (SVN) repository 下載源代碼,不要從 sourceforge 上下載, sourceforge 上特別慢。
dos 下轉到 E:/project/openbravo 目錄
 
將得到最新的源代碼
導入項目
在導入項目前,一定要取消自動編譯,因爲剛剛導入的項目會有很多 error ,所以會浪費時間。
  • 導入 openbravo
File > Import
General > Existing Projects into Workspace
選擇目錄 E:/project/openbravo/AppsOpenbravo ,然後選擇項目 openbravo
  • 導入 OpenbravoCore OpenbravoTrl OpenbravoWAD ,分別在目錄 src-core, src-trl, src-wad
  • 導入 OpenbravoDB ,這個是可選的,該項目用來初始化數據庫,在目錄 src-db
設置所有項目的編碼爲 UTF-8, 以避免亂碼問題。
 
Openbravo.properties
在開始安裝,編譯之前,需要配置一些參數。這個是用來生成系統使用的 openbravo.properties.   打開目錄 E:/project/openbravo/AppsOpenbravo/config
 
執行 setup-properties-windows.exe
點擊 next
設置日期格式
設置 URL ,替換 localhost 爲機器的 ip ,這樣其他機器纔可以訪問,端口爲 tomcat 的端口。
使用缺省,點擊 next
選擇使用的數據庫
填寫數據庫的 SID 以及數據庫系統用戶的用戶名密碼, ob 系統使用的用戶和密碼。
這裏還應該有 server port 兩項,但不知道爲什麼我機器上總是顯示不出來 . 整個這個過程是爲了生成 openbravo.properties, 如果上述有問題可以,新建一個 openbravo.properties 文件,然後直接複製 Openbravo.properties.template 內容,修改響應的數據庫連接信息。
如何創建 setup-properties-windows.exe 這個工具,參見另外一個文檔生成 setup-properties-windows_exe.doc
參照樣例
# *************************************************************************
# * The contents of this file are subject to the Openbravo Public License
# * Version 1.0 (the "License"), being   the Mozilla   Public License
# * Version 1.1 with a permitted attribution clause; you may not use this
# * file except in compliance with the License. You may obtain a copy of
# * the License at http://www.openbravo.com/legal/license.html
# * Software distributed under the License is distributed on an "AS IS"
# * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# * License for the specific language governing rights and limitations
# * under the License.
# * The Original Code is Openbravo ERP.
# * The Initial Developer of the Original Code is Openbravo SL
# * All portions are Copyright (C) 2007 Openbravo SL
# * All Rights Reserved.
# * Contributor(s): ______________________________________.
# ************************************************************************
 
dateFormat.js= %d-%m-%Y
dateFormat.sql= DD-MM-YYYY
dateFormat.java= dd-MM-yyyy
dateTimeFormat.java= dd-MM-yyyy HH : mm:ss
 
 
bbdd.outputscript= ~/databasescript.sql
bbdd.verbosity= INFO
application.version= 2.35
developer.id= 1
 
#DB properties
bbdd.sid= orcl
bbdd.systemUser= SYSTEM
bbdd.systemPassword= SYSTEM
bbdd.user= obdb
bbdd.password= obdb
bbdd.driver= oracle.jdbc.driver.OracleDriver
bbdd.url= jdbc : oracle:thin:obdb/obdb@localhost:1521:orcl
bbdd.rdbms= ORACLE
bbdd.server= localhost
bbdd.port= 1521
 
# build.xml properties
base.app= AppsOpenbravo
base.source= E : /project/openbravo/AppsOpenbravo
attach.path= E : /openbravo/attachment
web.url= http : //localhost:8770/openbravo/web
context.url= http : //localhost:8770/openbravo
base.temp= E : /temp
 
bbdd.sessionConfig= ALTER SESSION SET NLS_LANGUAGE='SPANISH' NLS_DATE_FORMAT='DD-MM-YYYY' NLS_NUMERIC_CHARACTERS='.,'
 
生成 openbravo.properties 後,刷新 openbravo 項目。
生成數據庫
目前這些項目除了 OpenbravoDB 這個項目外,其他的可能都有編譯錯誤。這個現在可以不必再意。
運行 ant 任務生成數據庫
Run > external tools > create.database
或者在 dos 窗口下,轉到目錄 E:/project/openbravo/AppsOpenbravo/ 下,運行 ant create.database
 
執行此任務後,系統在數據中建立新的用戶,並建立所有的數據庫表和基礎數據。
執行結果信息
Buildfile: E:/project/openbravo/AppsOpenbravo/build.xml
 
init :
 
create.database :
 
init :
 
database.lib :
 
clean :
      [ delete ] Deleting directory E:/project/openbravo/AppsOpenbravo/src-db/build/classes
      [ delete ] Deleting directory E:/project/openbravo/AppsOpenbravo/src-db/build/lib
      [ delete ] Deleting directory E:/project/openbravo/AppsOpenbravo/src-db/docs
 
init :
       [ mkdir ] Created dir: E:/project/openbravo/AppsOpenbravo/src-db/build/classes
       [ mkdir ] Created dir: E:/project/openbravo/AppsOpenbravo/src-db/build/lib
       [ mkdir ] Created dir: E:/project/openbravo/AppsOpenbravo/src-db/docs
 
compile :
       [ javac ] Compiling 220 source files to E:/project/openbravo/AppsOpenbravo/src-db/build/classes
       [ javac ] Note: Some input files use unchecked or unsafe operations.
       [ javac ] Note: Recompile with -Xlint:unchecked for details.
        [ copy ] Copying 26 files to E:/project/openbravo/AppsOpenbravo/src-db/build/classes
 
build.jar :
         [ jar ] Building jar: E:/project/openbravo/AppsOpenbravo/src-db/build/lib/dbmanager.jar
 
jar :
        [ copy ] Copying 1 file to E:/project/openbravo/AppsOpenbravo/database/lib
 
create.database :
 
clean.database.ORACLE :
         [ sql ] Executing commands
         [ sql ] Failed to execute:   DROP USER obdb CASCADE
         [ sql ] java.sql.SQLException : ORA-01918: user 'OBDB' does not exist
         [ sql ] 0 of 1 SQL statements executed successfully
 
prepare.database :
 
ORACLE.structure :
         [ sql ] Executing commands
         [ sql ] 1 of 1 SQL statements executed successfully
         [ sql ] Executing commands
         [ sql ] 1 of 1 SQL statements executed successfully
         [ sql ] Executing commands
         [ sql ] 2 of 2 SQL statements executed successfully
 
create.database.structure :
[ createdatabase ] [INFO] CreateDatabase - Executing creation script
[ createdatabase ] [INFO] Oracle8Platform - Executed 4654 SQL command(s) with 0 error(s)
[ createdatabase ] [INFO] CreateDatabase - Executing default postscript
[ createdatabase ] [INFO] Oracle8Platform - Executed 2 SQL command(s) with 0 error(s)
[ createdatabase ] [INFO] CreateDatabase - Executing system model script
[ createdatabase ] [INFO] Oracle8Platform - Executed 1 SQL command(s) with 0 error(s)
 
import.database.data :
 [ importdata ] [INFO] ImportDataXML - Model loaded from database.
 
database.postcreate.ORACLE :
         [ sql ] Executing commands
         [ sql ] 3 of 3 SQL statements executed successfully
 
import.database.sampledata :
 [ importdata ] [INFO] ImportDataXML - Model loaded from database.
 
database.postcreate.ORACLE :
         [ sql ] Executing commands
         [ sql ] 3 of 3 SQL statements executed successfully
BUILD SUCCESSFUL
Total time: 23 minutes 31 seconds
Toad 中用 obdb/obdb 登錄查看
 
OpenbravoCore
Clear 項目 project > clear 注意,取消立即編譯 (start a build immediately)
選擇項目 OpenbravoCore 然後點擊 Project > Build Project build 該項目 .
OpenbravoTrl
  • 點擊 Run > External Tools > eclipse.trl.lib ,也可以在 dos 下執行這個 ant 任務 .
  • Console 窗口,確認有 BUILD SUCCESSFUL 信息 .
  • 刷新 OpenbravoTrl.
  • 然後點擊 Project > Build Project 菜單編譯項目 .
Buildfile: E:/project/openbravo/AppsOpenbravo/build.xml
 
init :
 
eclipse.trl.lib :
 
init :
 
sqlc :
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - strFileProperties: E:/project/openbravo/AppsOpenbravo/config/Openbravo.properties
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - javaDateFormat: dd-MM-yyyy
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - directory source: ./src
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - directory destiny: E:/project/openbravo/AppsOpenbravo/src-trl/build/javasqlc
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - file termination: .xsql
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - file connection: E:/project/openbravo/AppsOpenbravo/config/Openbravo.properties
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - Write TXT Files: false
        [ java ] 1016 [main] INFO org.openbravo.data.Sqlc - Loading driver: oracle.jdbc.driver.OracleDriver
        [ java ] 1157 [main] INFO org.openbravo.data.Sqlc - Driver loaded
        [ java ] 2297 [main] INFO org.openbravo.data.Sqlc - connect made
        [ java ] 2375 [main] INFO org.openbravo.data.Sqlc - File: ./src/org/openbravo/translate/Translate_data.xsql processed
BUILD SUCCESSFUL
Total time: 7 seconds
 
OpenbravoWAD
  • 點擊 Run > External Tools > eclipse.wad.lib. 也可以在 dos 下執行這個 ant 任務
  • Console 窗口,確認有 BUILD SUCCESSFUL 信息 .
  • 刷新 OpenbravoWAD .
  • 點擊 Project > Build Project 菜單來編譯這個項目 .
 
Buildfile: E:/project/openbravo/AppsOpenbravo/build.xml
 
init :
 
eclipse.wad.lib :
 
init :
 
sqlc :
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - strFileProperties: E:/project/openbravo/AppsOpenbravo/config/Openbravo.properties
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - javaDateFormat: dd-MM-yyyy
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - directory source: ./src/org
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - directory destiny: E:/project/openbravo/AppsOpenbravo/src-wad/build/javasqlc
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - file termination: .xsql
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - file connection: E:/project/openbravo/AppsOpenbravo/config/Openbravo.properties
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - Write TXT Files: false
        [ java ] 266 [main] INFO org.openbravo.data.Sqlc - Loading driver: oracle.jdbc.driver.OracleDriver
        [ java ] 281 [main] INFO org.openbravo.data.Sqlc - Driver loaded
        [ java ] 781 [main] INFO org.openbravo.data.Sqlc - connect made
BUILD SUCCESSFUL
Total time: 2 seconds
 
openbravo
  • 點擊 Run > External Tools > eclipse.compile.complete ,也可以在 dos 下執行這個 ant 任務 .
  • Console 窗口,確認有 BUILD SUCCESSFUL 信息 .
  • 刷新 openbravo .
  • 然後點擊 Project > Build Project 菜單進行編譯 .
這個會有很長很長的輸出信息。
定義 Tomcat server
爲了在 eclipseIDE 中運行 OpenBravo ,那麼需要定義 Tomcat server.
  • 點擊 window > Preferences 選擇 Server > Installed Runtimes
點擊 Add
選擇 Apache tomcat V5.5 ,點 next
選擇你安裝的 tomcat 目錄 jre 點擊 finish
eclipse 左側 Servers 上點擊右鍵 New > other
       然後選擇 Server 下面的 Server
或者在 Servers tab 中右鍵 New > Server
點擊 next
將左側的 openbravo 項目加入到右側中
點擊 finish
OpenBravo 的文檔上說可以設置 Serve modules without publishing 爲選中,這樣可以不用拷貝資源到 tomcat 臨時目錄中去,但我嘗試不可以,不知道哪裏設置的不對
 
啓動 Tomcat server
選中創建的 server ,然後點擊 start 圖標,或者右鍵 start
系統顯示 publishing…, 會持續大幾分鐘,耐心等待。
Tomcat 狀態爲 starting 之後
登錄系統 http://localhost:8770/openbravo 用戶名 Openbravo 密碼 openbravo 主意大小寫
恭喜你可以開始嘗試 openbravo 了。

  轉載:http://blog.csdn.net/quzgxi/archive/2007/12/06/1921663.aspx

發佈了12 篇原創文章 · 獲贊 7 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章