gradle ofbiz 16 开发环境搭建

时间:2021-06-16 14:56:38
gradle ofbiz 16 开发环境搭建

1.安装jdk

2.配置jdk环境变量

3.eclipse 安装svn 插件

4.svn下载Apache OFBiz 16.11.01 源码

5.下载gradle3.3 插件 存放目录C:\Users\Administrator\.gradle\wrapper\dists

6.配置mysql 数据库所需jar包 修改build.gradle 加入compile 'mysql:mysql-connector-java:5.1.24'


7.修改数据库文件默认配置

  1. <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">  
  2.     <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>  
  3.     <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>  
  4.     <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>  
  5. </delegator>  
  6. <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">  
  7.     <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>  
  8.     <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>  
  9.     <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>  
  10. </delegator>  
  11.   
  12. <!-- be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "gradlew loadDefault" before running "gradlew testIntegration" -->  
  13. <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">  
  14.     <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>  
  15.     <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>  
  16.     <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>  
  17. </delegator>  


   
  1. <datasource name="localmysql"  
  2.             helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"  
  3.             field-type-name="mysql"  
  4.             check-on-start="true"  
  5.             add-missing-on-start="true"  
  6.             check-pks-on-start="false"  
  7.             use-foreign-keys="true"  
  8.             join-style="ansi-no-parenthesis"  
  9.             alias-view-columns="false"  
  10.             drop-fk-use-foreign-key-keyword="true"  
  11.             table-type="InnoDB"  
  12.             character-set="utf8"  
  13.             collate="utf8_general_ci">  
  14.         <read-data reader-name="tenant"/>  
  15.         <read-data reader-name="seed"/>  
  16.         <read-data reader-name="seed-initial"/>  
  17.         <read-data reader-name="demo"/>  
  18.         <read-data reader-name="ext"/>  
  19.         <read-data reader-name="ext-test"/>  
  20.         <read-data reader-name="ext-demo"/>  
  21.         <inline-jdbc  
  22.                 jdbc-driver="com.mysql.jdbc.Driver"  
  23.                 jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz?characterEncoding=utf-8&autoReconnect=true"  
  24.                 jdbc-username="root"  
  25.                 jdbc-password="root"  
  26.                 isolation-level="ReadCommitted"  
  27.                 pool-minsize="2"  
  28.                 pool-maxsize="250"  
  29.                 time-between-eviction-runs-millis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL  
  30.                 and had to set it to -1 in order to avoid this issue.  
  31.                 For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html-->  
  32.         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->  
  33.     </datasource>  
  34.     <datasource name="localmysqlolap"  
  35.             helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"  
  36.             field-type-name="mysql"  
  37.             check-on-start="true"  
  38.             add-missing-on-start="true"  
  39.             check-pks-on-start="false"  
  40.             use-foreign-keys="true"  
  41.             join-style="ansi-no-parenthesis"  
  42.             alias-view-columns="false"  
  43.             drop-fk-use-foreign-key-keyword="true"  
  44.             table-type="InnoDB"  
  45.             character-set="utf8"  
  46.             collate="utf8_general_ci">  
  47.         <read-data reader-name="tenant"/>  
  48.         <read-data reader-name="seed"/>  
  49.         <read-data reader-name="seed-initial"/>  
  50.         <read-data reader-name="demo"/>  
  51.         <read-data reader-name="ext"/>  
  52.         <read-data reader-name="ext-test"/>  
  53.         <read-data reader-name="ext-demo"/>  
  54.         <inline-jdbc  
  55.                 jdbc-driver="com.mysql.jdbc.Driver"  
  56.                 jdbc-uri="jdbc:mysql://127.0.0.1/ofbizolap?characterEncoding=utf-8&autoReconnect=true"  
  57.                 jdbc-username="root"  
  58.                 jdbc-password="root"  
  59.                 isolation-level="ReadCommitted"  
  60.                 pool-minsize="2"  
  61.                 pool-maxsize="250"  
  62.                 time-between-eviction-runs-millis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL  
  63.                 and had to set it to -1 in order to avoid this issue.  
  64.                 For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html-->  
  65.         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->  
  66.     </datasource>  
  67.     <datasource name="localmysqltenant"  
  68.             helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"  
  69.             field-type-name="mysql"  
  70.             check-on-start="true"  
  71.             add-missing-on-start="true"  
  72.             check-pks-on-start="false"  
  73.             use-foreign-keys="true"  
  74.             join-style="ansi-no-parenthesis"  
  75.             alias-view-columns="false"  
  76.             drop-fk-use-foreign-key-keyword="true"  
  77.             table-type="InnoDB"  
  78.             character-set="utf8"  
  79.             collate="utf8_general_ci">  
  80.         <read-data reader-name="tenant"/>  
  81.         <read-data reader-name="seed"/>  
  82.         <read-data reader-name="seed-initial"/>  
  83.         <read-data reader-name="demo"/>  
  84.         <read-data reader-name="ext"/>  
  85.         <read-data reader-name="ext-test"/>  
  86.         <read-data reader-name="ext-demo"/>  
  87.         <inline-jdbc  
  88.                 jdbc-driver="com.mysql.jdbc.Driver"  
  89.                 jdbc-uri="jdbc:mysql://127.0.0.1/ofbiztenant?characterEncoding=utf-8&autoReconnect=true"  
  90.                 jdbc-username="root"  
  91.                 jdbc-password="root"  
  92.                 isolation-level="ReadCommitted"  
  93.                 pool-minsize="2"  
  94.                 pool-maxsize="250"  
  95.                 time-between-eviction-runs-millis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL  
  96.                 and had to set it to -1 in order to avoid this issue.  
  97.                 For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html-->  
  98.         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->  
  99.     </datasource>  
8.本地数据库创建MySQL数据库

  1. ofbiz ofbizolap ofbiztenant三个库  
设置编码格式字符集utf8 -- UTF-8 排序规则Unicode utf8_general_ci


9.命令行gradlew loadDefault 加载默认数据

gradle ofbiz 16 开发环境搭建

10.命令行  gradlew  ofbiz启动

https://127.0.0.1:8443/ecommerce/control/main 前台访问

https://127.0.0.1:8443/accounting/control/setUserPreference 后台  账号admin密码ofbiz