ofbiz16.11.04(环境搭建)

ofbiz16.11.04(环境搭建)

版本说明:
ofbiz 16.11.04
下载地址:http://ofbiz.apache.org/download.html
gradle 4.9
下载地址:http://ofbiz.apache.org/download.html


安装

1.解压下载好的ofbiz
2.将gradle-4.9-bin.zip拷贝到ofbiz目录下的gradle/wrapper/目录中
3.修改gradle/wrapper/中的文件gradle-wrapper.properties中的distributionUrl属性

#Tue Jun 28 11:26:40 AST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=gradle-4.9-bin.zip

4.创建init.gradle文件路径如下:gradle-4.9-bin.zip/gradle-4.9/init.d

allprojects{
    repositories {
        def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                    remove repo
                }
                if (url.startsWith('https://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                    remove repo
                }
            }
        }
        maven {
            url ALIYUN_REPOSITORY_URL
            url ALIYUN_JCENTER_URL
        }
    }
}

启动

./ gradlew cleanAll loadDefault ofbiz

命令将在Derby数据库中加载ofbiz附带的演示数据并启动

默认的数据库为derby,可以把localderby改成Mysql  
1.修改数据库配置文件
路径如下:apache-ofbiz-16.11.04/framework/entity/config/entityengine.xml
修改默认数据库为Mysql

<delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
    <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>
<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">
    <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>
<delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
    <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
    <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
    <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
</delegator>

2.修改Mysql数据库配置信息 localmysql,localmysqlolap,localmysqltenant,odbcmysql 修改用户名及密码为自己的用户名密码

<datasource name="localmysql"
        helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"
        field-type-name="mysql"
        check-on-start="true"
        add-missing-on-start="true"
        check-pks-on-start="false"
        use-foreign-keys="true"
        join-style="ansi-no-parenthesis"
        alias-view-columns="false"
        drop-fk-use-foreign-key-keyword="true"
        table-type="InnoDB"
        character-set="latin1"
        collate="latin1_general_cs">
    <read-data reader-name="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
        jdbc-driver="com.mysql.jdbc.Driver"
        jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz?autoReconnect=true"
        jdbc-username="root"
        jdbc-password="root"
        isolation-level="ReadCommitted"
        pool-minsize="2"
        pool-maxsize="250"
        time-between-eviction-runs-millis="600000"/>
</datasource>

3.修改完毕后创建数据库:ofbizofbizolapofbiztenantofbiz_odbc
4.添加Mysql连接驱动到apache-ofbiz-16.11.04/lib目录下
5.输入以下指令重新启动

./ gradlew loadDefault ofbiz

创建插件/组件

1.创建ofbizDemo组件

./gradlew createPlugin -PpluginId=ofbizDemo

命令将会在apache-ofbiz-16.11.04/specialpurpose目录下生成ofbizDemo组件会包含基本配置文件
2.重新启动ofbiz( ./gradlew loadDefault ofbiz)以加载ofbizdemo组件
3.测试访问页面https://localhost:8443/ofbizDemo
4.用户登录:admin 密码:ofbiz

posted @ 2019-09-18 15:41  星朝  阅读(734)  评论(0编辑  收藏  举报