Skip to content

Commit

Permalink
Require Java 11, update to Groovy 3, JUnit 5, Gradle 7, etc (#527)
Browse files Browse the repository at this point in the history
* Update required java version to 11, with ReleaseNotes updates

* Update ElasticSearch to 7.10.2, the last Apache 2.0 licensed version; update build to add logs dir if missing, start process in background

* Update MoquiStart and MClassLoader definePackage() methods to get the Java 11 getDefinedPackage() instead of deprecated getPackage() which was evidently changed because it takes too long to google 'javadoc ClassLoader' and scroll down

* Updates related to an attempt to update Groovy to 3.0.8 with small code changes for type checking quirks and on the Groovy side seems to work fine, but this requires updating the Spock test framework and with the latest (2.0-groovy-3.0) getting errors about Invalid test class with No runnable methods

* Update .travis.yml file to use openjdk11

* Update Jetty to 10.0.6, including spec updates to Servlet 4.0 and Websocket 1.1; update RestClient and WebUtilities for changes in Jetty HTTP Client; update MoquiStart for small changes in the Jetty Websocket classes

* Java 11 (#518)

* moving to gradle 7

* moving to JUnit 5 and testing Karate Framework
-All test tasks now have "ignoreFailures = true" since some stock tests are failing already and blocking the custom tests of the user

* Update gradle to 6.9.1

* Upgrade gradle to version 6.9.1 / Update addons

* Update groovy in moqui-util

* Update dependencies to latest

* Update h2 dependency

* Update dependencies and change from api to implementation

* Update gradle to 7.4.1 / Upgrade to Groovy 3.0.10

* Update tests to junit 5 and groovy 3

* Change implementation to api

Co-authored-by: Mohammad Al-Hajj <[email protected]>
Co-authored-by: Mohammad Al-Hajj <[email protected]>

* Remove execWarRuntime.extendsFrom api, causes huge number of unwanted duplicate jars in the war file

* Go back to Groovy 3.0.9, there is some sort of bug in 3.0.10 that causes EntityDefinition.isViewEntity to flip from true to false after constructor, see comments in changes

* In framework/build.gradle a few cleanups and changes to work with both Gradle 5 and Gradle 7, with TODO once we give up on Gradle 5 and require Gradle 7 for this; framework:test still not working, added TODO note that when useJUnitPlatform is commented then it runs the tests but they all fail because it doesn't wait for the framework to start

* In framework/build.gradle more tasks.withType calls down by the others, these were at the top to easily comment/uncomment them over time, but for now are on all the time to help with updates

* Spock tests in framework working, but not using MoquiSuite.groovy, need alternative now that Spock uses JUnit Platform with some JUnit4 backward compatibility but not complete, like not including the TestSuite approach to control run order and cleanup after a set of test classes; also use older startElasticSearch approach because of ProcessBuilder issues on some platforms

* Update MoquiSuite.groovy to use JUnit Platform Suite and Jupiter annotations, add explicit include back to test task config in framework/build.gradle

* Add ReleaseNotes about recent changes and JUnit update that will not be backward compatible, at least not for Test Suites

* Disable lint warnings, most critical now resolved, will continue to use finalized to make sure things get cleaned up until completely removed, better to not have in there causing confusion vs real errors/etc for all except framework maintainers

* Remove comment that no longer applies

* Uncomment contents of GroovyShellEndpoint, change Groovysh import to new package in Groovy 3, add jline library explicitly which is required by groovy-groovysh but not in its dependencies

* In build.gradle plusRuntimeWarTemp task (used by addRuntime) exclude librepo directory, add duplicatesStrategy needed in Gradle 7 if there are duplicates; thanks to Jens for bringing this up, for PR #526 which had a variation on this but was against the master branch

Co-authored-by: Michael Jones <[email protected]>
Co-authored-by: Mohammad Al-Hajj <[email protected]>
Co-authored-by: Mohammad Al-Hajj <[email protected]>
  • Loading branch information
4 people authored Apr 25, 2022
1 parent f43500c commit cb2daac
Show file tree
Hide file tree
Showing 35 changed files with 421 additions and 317 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: groovy

jdk:
- openjdk8
- openjdk11

install: true

Expand Down
16 changes: 13 additions & 3 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@

Moqui Framework 3.0.0 is a major new feature and bug fix release.

In this release the old moqui-elasticsearch component with embedded ElasticSearch is no longer supported. Instead the new
Java 11 is now the minimum Java version required. For development and deployment make sure Java 11 is installed
(such as openjdk-11-jdk or adoptopenjdk-11-openj9 on Linux), active (on Linux use 'sudo update-alternatives --config java'),
and that JAVA_HOME is set to the Java 11 JDK install path (for openjdk-11-jdk on Linux: /usr/lib/jvm/java-11-openjdk-amd64).

In this release the old moqui-elasticsearch component with embedded ElasticSearch is no longer supported. Instead, the new
ElasticFacade is included in the framework as a client to an external ElasticSearch instance which can be installed in
runtime/elasticsearch and automatically started/stopped in a separate process by the MoquiStart class (executable WAR, not when
WAR file dropped into Servlet container).

Note that ElasticSearch 7.10.2 is the recommended version for this release, and is the last version released under the Apache 2.0
license. Going forward the alternatives include Open Search (https://opensearch.org/) or Open Distro for ElasticSearch (https://opendistro.github.io/for-elasticsearch/).

For a complete list of changes see:

https://github.com/moqui/moqui-framework/compare/v2.1.3...v3.0.0

### Non Backward Compatible Changes

- Java 11 is now required, updated from Java 8
- Updated Spock to 2.1 and with that update now using JUnit Platform and JUnit 5 (Jupiter); with this update old JUnit 4
tests should work, but JUnit 4 test suites need to be updated to use the JUnit Platform and Jupiter annotations
- Library updates have been done that conflict with ElasticSearch making it impossible to run embedded
- XMLRPC support had been partly removed years ago, is now completely removed
- CUPS4J library no longer included in moqui-framework
Expand All @@ -24,8 +34,8 @@ https://github.com/moqui/moqui-framework/compare/v2.1.3...v3.0.0

### New Features

- Recommended Gradle version is 5.6.4 (at least Gradle 5+ but not Gradle 6+ for compatibility with current plugins)
- Java versions 8 and 11 supported (compiles to Java 8 bytecode by default, does not use any Java 11 language constructs or API)
- Recommended Gradle version is 7+ with updates to support the latest versions of Gradle
- Updated Jetty to version 10 (which requires Java 11 or later)
- Optimization for startup-add-missing to get meta data for all tables and columns instead of per entity for much faster startup
when enabled; default for runtime-add-missing is now 'false' and startup-add-missing is now 'true' for all DBs including H2
- View Entity find improvements
Expand Down
4 changes: 2 additions & 2 deletions addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
some components change system behavior and may cause unexpected and undesired results -->
<component-set name="framework" components="example,moqui-aws,moqui-cups,moqui-fop,moqui-hazelcast,moqui-kie,moqui-orientdb,moqui-poi,moqui-sftp,moqui-wikitext"/>
<component-set name="mantle" components="mantle-udm,mantle-usl,AuthorizeDotNet,mantle-edi,mantle-paytrace,mantle-shippo,mantle-yotpo"/>
<component-set name="apps" components="HiveMind,PopCommerce,PopRestStore"/>
<component-set name="apps" components="HiveMind,PopCommerce,PopRestStore,MarbleERP"/>
<component-set name="ecosystem" sets="framework,mantle,apps"/>

<component-set name="demo" components="example,HiveMind,PopCommerce,PopRestStore"/>
<component-set name="demo" components="example,HiveMind,PopCommerce,PopRestStore,MarbleERP"/>
<component-set name="popc" components="PopCommerce,PopRestStore"/>

<!-- Release builds:
Expand Down
23 changes: 17 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.ajoberstar.grgit.*

defaultTasks 'build'

def elasticSearchVersion = '7.4.2'
def elasticSearchVersion = '7.10.2'
def tomcatHome = '../apache-tomcat'
// no longer include version in war file name: def getWarName() { 'moqui-' + childProjects.framework.version + '.war' }
def getWarName() { 'moqui.war' }
Expand Down Expand Up @@ -147,13 +147,15 @@ task downloadElasticSearch { doLast {

delete zipFile
}}
/*
/* startElasticSearch old approach, with ES 7.10.2 never exits (though same command in terminal does) */
task startElasticSearch(type:Exec) {
workingDir moquiRuntime + '/elasticsearch'; commandLine './bin/elasticsearch', '-d', '-p', 'pid'
workingDir moquiRuntime + '/elasticsearch'
commandLine './bin/elasticsearch', '-d', '-p', 'pid'
ignoreExitValue true
onlyIf { file(moquiRuntime + '/elasticsearch/bin').exists() && !file(moquiRuntime + '/elasticsearch/pid').exists() }
doFirst { logger.lifecycle("Starting ElasticSearch installed in runtime/elasticsearch") }
}
*/
/* startElasticSearch new approach with ProcessBuilder, note that does nothing on macOS with Azul OpenJDK 11
task startElasticSearch { doLast {
def pidFile = file(moquiRuntime + '/elasticsearch/pid')
def esBinFile = file(moquiRuntime + '/elasticsearch/bin')
Expand All @@ -169,6 +171,7 @@ task startElasticSearch { doLast {
if (!esBinFile.exists()) logger.lifecycle("Not Starting ElasticSearch, no runtime/elasticsearch/bin directory found")
}
} }
*/
task stopElasticSearch { doLast {
String esDir = moquiRuntime + '/elasticsearch'
def pidFile = file(moquiRuntime + '/elasticsearch/pid')
Expand Down Expand Up @@ -680,8 +683,16 @@ task plusRuntimeWarTemp {
copy { from fileTree(dir: moquiRuntime+'/classes', include: '**/*') into 'wartemp/WEB-INF/classes' }
// copy the jar files from components
copy { from fileTree(dir: moquiRuntime+'/base-component', include: '**/*.jar').files into 'wartemp/WEB-INF/lib' }
copy { from fileTree(dir: moquiRuntime+'/component', include: '**/*.jar').files into 'wartemp/WEB-INF/lib' }
copy { from fileTree(dir: moquiRuntime+'/ecomponent', include: '**/*.jar').files into 'wartemp/WEB-INF/lib' }
copy {
from fileTree(dir: moquiRuntime+'/component', include: '**/*.jar', exclude: '**/librepo/*.jar').files
into 'wartemp/WEB-INF/lib'
duplicatesStrategy DuplicatesStrategy.WARN
}
copy {
from fileTree(dir: moquiRuntime+'/ecomponent', include: '**/*.jar', exclude: '**/librepo/*.jar').files
into 'wartemp/WEB-INF/lib'
duplicatesStrategy DuplicatesStrategy.WARN
}
// add MoquiInit.properties fresh copy, just in case it was changed
copy { from file('MoquiInit.properties') into 'wartemp/WEB-INF/classes' }
// add Procfile to root
Expand Down
4 changes: 2 additions & 2 deletions docker/moqui-cluster1-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ services:

elasticsearch:
# very important: use the '-oss' version otherwise x-pack is included and because of licensing, etc moqui instances can't join the cluster
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
container_name: elasticsearch
# command: elasticsearch
restart: always
Expand All @@ -184,7 +184,7 @@ services:
- network.host=_site_

kibana:
image: docker.elastic.co/kibana/kibana-oss:7.4.2
image: docker.elastic.co/kibana/kibana-oss:7.10.2
container_name: kibana
restart: always
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker/moqui-ng-my-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
- MYSQL_PASSWORD=moqui

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
container_name: elasticsearch
restart: always
ports:
Expand Down
4 changes: 2 additions & 2 deletions docker/moqui-ng-my-kib-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ services:
- MYSQL_PASSWORD=moqui

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
container_name: elasticsearch
restart: always
ports:
Expand All @@ -116,7 +116,7 @@ services:
- network.host=_site_

kibana:
image: docker.elastic.co/kibana/kibana-oss:7.4.2
image: docker.elastic.co/kibana/kibana-oss:7.10.2
container_name: kibana
restart: always
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker/moqui-ng-pg-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
# PGDATA, POSTGRES_INITDB_ARGS

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.4.2
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
container_name: elasticsearch
restart: always
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker/simple/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Builds a minimal docker image with openjdk and moqui with various volumes for configuration and persisted data outside the container
# NOTE: add components, build and if needed load data before building a docker image with this

FROM openjdk:8-jdk
FROM openjdk:11-jdk
MAINTAINER Moqui Framework <[email protected]>

WORKDIR /opt/moqui
Expand Down
Loading

0 comments on commit cb2daac

Please sign in to comment.