From 0513db81275f6c4a4afe10b2e269017b35b8c9a1 Mon Sep 17 00:00:00 2001 From: Shi Jinghai Date: Fri, 19 Jun 2020 03:34:00 +0800 Subject: [PATCH] Upgrade to OFBiz 18.12 --- README.md | 16 +++++++--------- build.gradle | 4 ++-- docs/README_ZH.md | 14 +++++++------- patches/ofbiz/build.gradle.patch | 4 ++-- patches/ofbiz/cookie-name-slash.patch | 9 +++++++-- .../ofbiz/startup-with-webapp-context.xml.patch | 16 ++++------------ 6 files changed, 29 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 4b599c9..b89947b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Welcome any kind of contributions to this plugin. ### Quick Start -**1. Checkout OFBiz 17.12.03 from https://github.com/apache/ofbiz-framework** +**1. Checkout OFBiz 18.12 from https://github.com/apache/ofbiz-framework**
@@ -38,7 +38,7 @@ Welcome any kind of contributions to this plugin.
-**5. Download gradle 5.6 and install. If you use gradlew, please edit gradle/wrapper/gradle-wrapper.properties, change to use gradle 5.6:** +**5. Gradle 5.0 is OK in my environment. If not in yours, please edit gradle/wrapper/gradle-wrapper.properties, change to use gradle 5.6:** ``` distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip @@ -164,7 +164,7 @@ and check a specific container status, i.e. mortgages:mortgages:1.0.0-SNAPSHOT, **3. Why apply patches/ofbiz/startup-with-webapp-context.xml.patch** -As you see, when deploying kie-drools-wb or kie-server in tomcat, the META-INF/context.xml is applied. In OFBiz 17.12.03, it's not. With patches/ofbiz/startup-with-webapp-context.xml.patch, META-INF/context.xml is configured, and then authz and taglibs can work as expected: +As you see, when deploying kie-drools-wb or kie-server in tomcat, the META-INF/context.xml is applied. In OFBiz 18.12, it's not. With patches/ofbiz/startup-with-webapp-context.xml.patch, META-INF/context.xml is configured, and then authz and taglibs can work as expected: ```java StandardContext context = new StandardContext(); @@ -323,15 +323,13 @@ Common class loader classes (described above) If your OFBiz is class loader type one, this patch is unnecessary as src/main/java/org/kie/server/services/impl/controller/DefaultRestControllerImpl.java will be built and deployed under /WEB-INF/classes. -If your OFBiz is type two and this is what I see in OFBiz 17.12.03, the patch can be applied to [droolsjbpm-integration/kie-server-parent/kie-server-services/kie-server-services-common](https://github.com/kiegroup/droolsjbpm-integration/tree/7.17.0.Final/kie-server-parent/kie-server-services/kie-server-services-common). The lib/kie-server-services-common-7.17.0.Final.jar is built with this patch. +If your OFBiz is type two and this is what I see in OFBiz 18.12, the patch can be applied to [droolsjbpm-integration/kie-server-parent/kie-server-services/kie-server-services-common](https://github.com/kiegroup/droolsjbpm-integration/tree/7.17.0.Final/kie-server-parent/kie-server-services/kie-server-services-common). The lib/kie-server-services-common-7.17.0.Final.jar is built with this patch.
-**8. Why gradle 5.6** +**8. Gradle 5.0** -The gradle version in gradle/wrapper/gradle-wrapper.properties is 3.2.1. It has a problem to download files required by drools plugin properly and build Class-Path of MANIFEST.MF for ofbiz.jar correctly. In this case, it cannot resolve lucene version as expected. As we know, OFBiz use this Class-Path as classpath when starting. I happen to change 3.2.1 to 5.6 and it's ok. I guess many other gradle versions also work fine but I didn't try. - -![MANIFEST](docs/images/sandflower-MANIFEST-MF-17.12.03.png) +The gradle version in gradle/wrapper/gradle-wrapper.properties is 5.0, it works fine in my environment. If you have problem to download files required by drools plugin or generate wrong Class-Path of MANIFEST.MF for ofbiz.jar, you can try gradle 5.6.
@@ -373,7 +371,7 @@ The 2nd reason is kie 7.17.0.Final is the latest version support cdi-api 1.x whi **11. Don't forget to match Elasticsearch and Lucene version with ofbiz-plugins** -The lucene version in [OFBiz Lucene plugin 17.12.03](https://github.com/apache/ofbiz-plugins/blob/release17.12.03/lucene/build.gradle) is 7.1.0, which is newer than the version in kie, I changed several java files under src/main/java/org/uberfire/ext/ to match this version upgrade, and use Elasticsearch 6.1.1 accordingly. +The lucene version in [OFBiz Lucene plugin 18.12](https://github.com/apache/ofbiz-plugins/blob/release18.12/lucene/build.gradle) is 7.5.0, which is newer than the version in kie, I changed several java files under src/main/java/org/uberfire/ext/ to match this version upgrade, and use Elasticsearch 6.5.1 accordingly.
diff --git a/build.gradle b/build.gradle index 8c4056d..472c256 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ def dashbuilderVersion = '2.14.0.Final' def uberfireVersion = '2.14.0.Final' def erraiVersion = '4.4.1.Final' // lucene 7.1.0 -def elasticsearchVersion = '6.1.1' -def luceneVersion = '7.1.0' +def elasticsearchVersion = '6.5.1' +def luceneVersion = '7.5.0' // for tomcat 9.0.x def tomcatVersion = '9.0.31' def resteasyVersion = '3.0.26.Final' // cdi-api 1.2 diff --git a/docs/README_ZH.md b/docs/README_ZH.md index f81febd..3459a90 100644 --- a/docs/README_ZH.md +++ b/docs/README_ZH.md @@ -22,7 +22,7 @@ OFBiz Drools插件把[kie drools工作台](https://github.com/kiegroup/kie-wb-di ### 快速使用 -**1. 从https://github.com/apache/ofbiz-framework检出OFBiz 17.12.03** +**1. 从https://github.com/apache/ofbiz-framework检出OFBiz 18.12**
@@ -38,7 +38,7 @@ OFBiz Drools插件把[kie drools工作台](https://github.com/kiegroup/kie-wb-di
-**5. 下载和安装gradle 5.6。如果你使用gradlew命令,请编辑gradle/wrapper/gradle-wrapper.properties文件,修改为使用gradle 5.6:** +**5. 在我的开发环境里,Gradle 5.0可以正常使用。如果在你的环境下不行,可以试试Gradle 5.6,请编辑gradle/wrapper/gradle-wrapper.properties文件,修改为使用gradle 5.6:** ``` distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip @@ -162,7 +162,7 @@ gradle ofbiz **3. 为什么要打patches/ofbiz/startup-with-webapp-context.xml.patch补丁** -如你所知,当把kie-drools-wb或kie-server部署到Tomcat下时,META-INF/context.xml会生效。在OFBiz 17.12.03,它没有生效。通过打 patches/ofbiz/startup-with-webapp-context.xml.patch补丁,META-INF/context.xml才会生效,然后认证和JSP标签才能起作用: +如你所知,当把kie-drools-wb或kie-server部署到Tomcat下时,META-INF/context.xml会生效。在OFBiz 18.12,它没有生效。通过打 patches/ofbiz/startup-with-webapp-context.xml.patch补丁,META-INF/context.xml才会生效,然后认证和JSP标签才能起作用: ```java StandardContext context = new StandardContext(); @@ -315,13 +315,13 @@ Common class loader classes (described above) 如果你的OFBiz是加载类型一,不需要使用这个补丁,因为src/main/java/org/kie/server/services/impl/controller/DefaultRestControllerImpl.java编译后会被部署到/WEB-INF/classes,这个类会生效。 -如果你的OFBiz是加载类型二,这也是我下载的OFBiz 17.12.03的类型,这个补丁打到[droolsjbpm-integration/kie-server-parent/kie-server-services/kie-server-services-common](https://github.com/kiegroup/droolsjbpm-integration/tree/7.17.0.Final/kie-server-parent/kie-server-services/kie-server-services-common)。lib/kie-server-services-common-7.17.0.Final.jar是打了这个补丁的jar,直接使用即可。 +如果你的OFBiz是加载类型二,这也是我下载的OFBiz 18.12的类型,这个补丁打到[droolsjbpm-integration/kie-server-parent/kie-server-services/kie-server-services-common](https://github.com/kiegroup/droolsjbpm-integration/tree/7.17.0.Final/kie-server-parent/kie-server-services/kie-server-services-common)。lib/kie-server-services-common-7.17.0.Final.jar是打了这个补丁的jar,直接使用即可。
-**8. 为什么使用Gradle 5.6** +**8. Gradle 5.0** -gradle/wrapper/gradle-wrapper.properties中的Gradle版本是3.2.1,它无法正确生成ofbiz.jar中的MANIFEST.MF的Class-Path,在这里,主要是不能正确解决Lucene版本。我们知道,OFBiz启动时,使用这个Class-Path作为classpath。我偶然把3.2.1改成了5.6,就可以了。我猜很多比3.2.1高的版本都可以,但是我没有试。 +gradle/wrapper/gradle-wrapper.properties中的Gradle版本是5.0,在我的环境下,可以正确执行。如果在你的环境下不行,可以尝试使用Gradle 5.6。判断是否正确的标准,是看它能否正确生成ofbiz.jar中的MANIFEST.MF的Class-Path,我们知道,OFBiz启动时,使用这个Class-Path作为classpath。 ![MANIFEST](images/sandflower-MANIFEST-MF-17.12.03.png) @@ -365,7 +365,7 @@ OFBiz build.gradle中包含了juel-impl-2.2.7.jar: **11. 别忘记匹配ofbiz-plugins中的Lucene版本** -[OFBiz Lucene plugin 17.12.03](https://github.com/apache/ofbiz-plugins/blob/release17.12.03/lucene/build.gradle)中的Lucene版本是7.1.0,比Kie中的版本新。我修改了src/main/java/org/uberfire/ext/下的几个文件,来匹配这个版本变化,并使用Elasticsearch 6.1.1。 +[OFBiz Lucene plugin 18.12](https://github.com/apache/ofbiz-plugins/blob/release18.12/lucene/build.gradle)中的Lucene版本是7.5.0,比Kie中的版本新。我修改了src/main/java/org/uberfire/ext/下的几个文件,来匹配这个版本变化,并使用Elasticsearch 6.5.1。
diff --git a/patches/ofbiz/build.gradle.patch b/patches/ofbiz/build.gradle.patch index d3528e0..3370f66 100644 --- a/patches/ofbiz/build.gradle.patch +++ b/patches/ofbiz/build.gradle.patch @@ -1,8 +1,8 @@ diff --git a/build.gradle b/build.gradle -index 272381f..e28107b 100644 +index d6e27a0..6ef6ea8 100644 --- a/build.gradle +++ b/build.gradle -@@ -46,7 +46,7 @@ +@@ -47,7 +47,7 @@ ext.pluginsDir = "${rootDir}/plugins" // java settings diff --git a/patches/ofbiz/cookie-name-slash.patch b/patches/ofbiz/cookie-name-slash.patch index b040f3b..96275fb 100644 --- a/patches/ofbiz/cookie-name-slash.patch +++ b/patches/ofbiz/cookie-name-slash.patch @@ -1,8 +1,8 @@ diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java -index be8ca2c..e6a9b07 100644 +index 9fe1f7f..8731a8d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java -@@ -731,7 +731,7 @@ +@@ -985,11 +985,11 @@ } protected static String getAutoLoginCookieName(HttpServletRequest request) { @@ -10,4 +10,9 @@ index be8ca2c..e6a9b07 100644 + return UtilHttp.getApplicationName(request).replaceAll("/", ".") + ".autoUserLoginId"; } + protected static String getSecuredLoginIdCookieName(HttpServletRequest request) { +- return UtilHttp.getApplicationName(request) + ".securedLoginId"; ++ return UtilHttp.getApplicationName(request).replaceAll("/", ".") + ".securedLoginId"; + } + public static String getAutoUserLoginId(HttpServletRequest request) { diff --git a/patches/ofbiz/startup-with-webapp-context.xml.patch b/patches/ofbiz/startup-with-webapp-context.xml.patch index cd94abe..0f6e592 100644 --- a/patches/ofbiz/startup-with-webapp-context.xml.patch +++ b/patches/ofbiz/startup-with-webapp-context.xml.patch @@ -1,5 +1,5 @@ diff --git a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java -index d300b70..8b64183 100644 +index aa1115f..55b29e5 100644 --- a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java +++ b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java @@ -20,6 +20,8 @@ @@ -11,15 +11,7 @@ index d300b70..8b64183 100644 import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; -@@ -33,7 +35,6 @@ - - import javax.naming.InitialContext; - import javax.naming.NamingException; -- - import org.apache.catalina.Context; - import org.apache.catalina.Engine; - import org.apache.catalina.Globals; -@@ -51,6 +52,7 @@ +@@ -51,6 +53,7 @@ import org.apache.catalina.ha.tcp.ReplicationValve; import org.apache.catalina.ha.tcp.SimpleTcpCluster; import org.apache.catalina.loader.WebappLoader; @@ -27,7 +19,7 @@ index d300b70..8b64183 100644 import org.apache.catalina.startup.ContextConfig; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.tribes.group.GroupChannel; -@@ -68,9 +70,11 @@ +@@ -68,9 +71,11 @@ import org.apache.ofbiz.base.container.ContainerConfig.Configuration; import org.apache.ofbiz.base.container.ContainerConfig.Configuration.Property; import org.apache.ofbiz.base.container.ContainerException; @@ -39,7 +31,7 @@ index d300b70..8b64183 100644 import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.webapp.WebAppUtil; -@@ -495,9 +499,26 @@ +@@ -493,9 +498,26 @@ ComponentConfig.WebappInfo appInfo, Property clusterProp) throws ContainerException { StandardContext context = new StandardContext();