Skip to content

Commit

Permalink
#151 : Upgrade to Boot 2.7
Browse files Browse the repository at this point in the history
* Bumped other production + test deps too.
* Use official maven wrapper.
* Upgraded Gradle wrapper.
* Also fixed broken Swagger docs title + description.
  • Loading branch information
gazbert committed Aug 18, 2022
1 parent af4dd48 commit 1dc4d9f
Show file tree
Hide file tree
Showing 29 changed files with 152 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and analyze
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=gazbert_bxbot -Dmaven.javadoc.skip=true -Pall
run: mvn -T 1C -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=gazbert_bxbot -Dmaven.javadoc.skip=true -Pall
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 17 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ If you want to just play around with the
and evaluate the bot, Docker is the way to go.

1. Install [Docker](https://docs.docker.com/engine/installation/) on the machine you want to run the bot.
1. Fetch the BX-bot image from [Docker Hub](https://hub.docker.com/r/gazbert/bxbot/): `docker pull gazbert/bxbot:1.4.0`
1. Run the Docker container: `docker container run --publish=8080:8080 --name bxbot-1.4.0 -it gazbert/bxbot:1.4.0 bash`
1. Fetch the BX-bot image from [Docker Hub](https://hub.docker.com/r/gazbert/bxbot/): `docker pull gazbert/bxbot:1.5.0`
1. Run the Docker container: `docker container run --publish=8080:8080 --name bxbot-1.5.0 -it gazbert/bxbot:1.5.0 bash`
1. Change into the bot's directory: `cd bxbot*`
1. Configure the bot as described in step 4 of the previous [Maven](#maven) section.
1. Usage: `./bxbot.sh [start|stop|status]`
Expand Down
35 changes: 17 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ buildscript {
}

dependencies {
classpath('io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE')
classpath('org.springframework.boot:spring-boot-gradle-plugin:2.6.6')
classpath('io.spring.gradle:dependency-management-plugin:1.0.13.RELEASE')
classpath('org.springframework.boot:spring-boot-gradle-plugin:2.7.2')
}
}

plugins {
id 'org.sonarqube' version '3.3'
id 'org.sonarqube' version '3.4.0.2513'
id 'jacoco'
id 'com.github.spotbugs' version '5.0.6'
id 'com.github.spotbugs' version '5.0.9'
}

buildScan {
Expand All @@ -23,17 +23,17 @@ buildScan {
}

ext.versions = [
springBootVersion : '2.6.6',
springCloudVersion : '3.1.1',
springBootVersion : '2.7.2',
springCloudVersion : '3.1.3',

// Should be same as dependency used by springBootVersion
springCoreVersion : '5.3.18',
springCoreVersion : '5.3.22',

springdocOpenapiVersion : '1.6.6',
hibernateVaildatorVersion: '7.0.1.Final',
springdocOpenapiVersion : '1.6.10',
hibernateVaildatorVersion: '7.0.5.Final',
jaxbVersion : '2.3.1',
javaxMailVersion : '1.6.2',
spotBugsVersion : '4.5.3.0'
spotBugsVersion : '4.7.1'
]

ext.libraries = [
Expand Down Expand Up @@ -61,9 +61,9 @@ ext.libraries = [
},
spring_tx : dependencies.create("org.springframework:spring-tx:" + ext.versions.springCoreVersion),
jjwt : dependencies.create("io.jsonwebtoken:jjwt:0.9.1"),
google_guava : dependencies.create("com.google.guava:guava:31.0.1-jre"),
google_gson : dependencies.create("com.google.code.gson:gson:2.9.0"),
h2 : dependencies.create("com.h2database:h2:2.1.210"),
google_guava : dependencies.create("com.google.guava:guava:31.1-jre"),
google_gson : dependencies.create("com.google.code.gson:gson:2.9.1"),
h2 : dependencies.create("com.h2database:h2:2.1.214"),
javax_mail_api : dependencies.create("javax.mail:javax.mail-api:" + ext.versions.javaxMailVersion),
javax_mail_sun : dependencies.create("com.sun.mail:javax.mail:" + ext.versions.javaxMailVersion),
javax_xml_api : dependencies.create("javax.xml.bind:jaxb-api:" + ext.versions.jaxbVersion),
Expand All @@ -72,7 +72,6 @@ ext.libraries = [

springdoc_openapi_ui : dependencies.create("org.springdoc:springdoc-openapi-ui:" + ext.versions.springdocOpenapiVersion),
springdoc_openapi_security : dependencies.create("org.springdoc:springdoc-openapi-security:" + ext.versions.springdocOpenapiVersion),
swagger_annotations : dependencies.create("io.swagger.core.v3:swagger-annotations:2.1.12"),

validation_api : dependencies.create("javax.validation:validation-api:2.0.1.Final"),
hibernate_validator : dependencies.create("org.hibernate.validator:hibernate-validator:" + ext.versions.hibernateVaildatorVersion),
Expand All @@ -83,13 +82,13 @@ ext.libraries = [
easymock : dependencies.create("org.easymock:easymock:4.3"),

// JUnit 4 still as Powermock does not play with Junit 5: https://github.com/powermock/powermock/issues/929
junit_vintage_engine : dependencies.create("org.junit.vintage:junit-vintage-engine:5.8.2"),
junit_vintage_engine : dependencies.create("org.junit.vintage:junit-vintage-engine:5.9.0"),

spring_boot_starter_test : dependencies.create("org.springframework.boot:spring-boot-starter-test:" + ext.versions.springBootVersion) {
exclude module: "spring-boot-starter-logging"
},
spring_security_test : dependencies.create("org.springframework.security:spring-security-test:5.6.2"),
awaitility : dependencies.create("org.awaitility:awaitility:4.1.1")
spring_security_test : dependencies.create("org.springframework.security:spring-security-test:5.7.3"),
awaitility : dependencies.create("org.awaitility:awaitility:4.2.0")
]

allprojects {
Expand All @@ -103,7 +102,7 @@ allprojects {
apply plugin: 'org.sonarqube'

group = 'com.gazbert.bxbot'
version = '1.4.1-SNAPSHOT'
version = '1.5.0'

dependencyManagement {
applyMavenExclusions = false
Expand Down
3 changes: 2 additions & 1 deletion bxbot-core/src/main/resources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ $$ | $$ |$$ /\$$\ $$ | $$ |$$ | $$ | $$ |$$\
$$$$$$$ |$$ / $$ | $$$$$$$ |\$$$$$$ | \$$$$ |
\_______/ \__| \__| \_______/ \______/ \____/

:: Spring Boot :: (v2.6.2)
Spring Boot : ${spring-boot.version}
BX-bot : ${application.version}
1 change: 0 additions & 1 deletion bxbot-domain-objects/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation libraries.hibernate_validator
implementation libraries.hibernate_validator_annotation_processor
implementation libraries.springdoc_openapi_ui
implementation libraries.swagger_annotations

testImplementation libraries.spring_boot_starter_test
}
Expand Down
5 changes: 2 additions & 3 deletions bxbot-rest-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies {

implementation libraries.springdoc_openapi_ui
implementation libraries.springdoc_openapi_security
implementation libraries.swagger_annotations

testImplementation libraries.spring_boot_starter_test
testImplementation libraries.spring_security_test
Expand All @@ -33,7 +32,7 @@ dependencies {

}

// FIXME: Broken with Gradle 7.3.3.
// FIXME: Broken with Gradle 7.3.3 :-(
jacocoTestCoverageVerification {
violationRules {
rule {
Expand All @@ -44,7 +43,7 @@ jacocoTestCoverageVerification {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0
minimum = 0.0
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*/
@org.springframework.web.bind.annotation.RestController
@Tag(name = "Authentication")
public class AuthenticationController implements RestController {
public class AuthenticationController extends RestController {

private final AuthenticationManager authenticationManager;
private final UserDetailsService userDetailsService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @author gazbert
* @since 1.0
*/
@PropertySource({"classpath:swagger.properties"})
@PropertySource({"classpath:swagger.properties", "classpath:application.properties"})
@OpenAPIDefinition(
info =
@Info(
Expand All @@ -48,5 +48,5 @@
url = "https://github.com/gazbert/bxbot/blob/master/LICENSE"),
termsOfService = "https://github.com/gazbert/bxbot"))
@SecurityRequirement(name = "Authorization")
public interface RestController {
public abstract class RestController {
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(CONFIG_ENDPOINT_BASE_URI)
@Tag(name = "Email Alerts Configuration")
public class EmailAlertsConfigController implements RestController {
public class EmailAlertsConfigController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String EMAIL_ALERTS_RESOURCE_PATH = "/email-alerts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(CONFIG_ENDPOINT_BASE_URI)
@Tag(name = "Engine Configuration")
public class EngineConfigController implements RestController {
public class EngineConfigController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String ENGINE_RESOURCE_PATH = "/engine";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(CONFIG_ENDPOINT_BASE_URI)
@Tag(name = "Exchange Configuration")
public class ExchangeConfigController implements RestController {
public class ExchangeConfigController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String EXCHANGE_RESOURCE_PATH = "/exchange";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(CONFIG_ENDPOINT_BASE_URI)
@Tag(name = "Market Configuration")
public class MarketConfigController implements RestController {
public class MarketConfigController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String MARKETS_RESOURCE_PATH = "/markets";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(CONFIG_ENDPOINT_BASE_URI)
@Tag(name = "Strategy Configuration")
public class StrategyConfigController implements RestController {
public class StrategyConfigController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String STRATEGIES_RESOURCE_PATH = "/strategies";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(RUNTIME_ENDPOINT_BASE_URI)
@Tag(name = "Bot Logfile")
public class BotLogfileController implements RestController {
public class BotLogfileController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String LOGFILE_RESOURCE_PATH = "/logfile";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(RUNTIME_ENDPOINT_BASE_URI)
@Tag(name = "Bot Restart")
public class BotRestartController implements RestController {
public class BotRestartController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String RESTART_RESOURCE_PATH = "/restart";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@org.springframework.web.bind.annotation.RestController
@RequestMapping(RUNTIME_ENDPOINT_BASE_URI)
@Tag(name = "Bot Status")
public class BotStatusController implements RestController {
public class BotStatusController extends RestController {

private static final Logger LOG = LogManager.getLogger();
private static final String STATUS_RESOURCE_PATH = "/status";
Expand Down
1 change: 1 addition & 0 deletions bxbot-rest-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application.version[email protected]@
2 changes: 1 addition & 1 deletion bxbot.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ REM log4j2 config file location
SET log4j2_config=.\config\log4j2.xml

REM The BX-bot 'fat' jar (Spring Boot app containing all the dependencies)
SET bxbot_jar=bxbot-app-1.4.1-SNAPSHOT.jar
SET bxbot_jar=bxbot-app-1.5.0.jar

REM PID file for checking if bot is running
SET pid_file=.\.bxbot.pid
Expand Down
2 changes: 1 addition & 1 deletion bxbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lib_dir=./libs
log4j2_config=./config/log4j2.xml

# The BX-bot 'fat' jar (Spring Boot app containing all the dependencies)
bxbot_jar=bxbot-app-1.4.1-SNAPSHOT.jar
bxbot_jar=bxbot-app-1.5.0.jar

# PID file for checking if bot is running
pid_file=./.bxbot.pid
Expand Down
2 changes: 0 additions & 2 deletions config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#
###############################################################################

application.version=@project.version@

# The Spring Boot management port.
# Setting it to -1 disables management endpoints over HTTP(S).
# Locked down to prevent remote access.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Loading

0 comments on commit 1dc4d9f

Please sign in to comment.