diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 083bcbbe8f0bd9cb3e5d649ca076404f1d30fdf2..d1fc7ee03c55f7bab03af696470013236a3d0036 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: openjdk:11-jdk +image: eclipse-temurin:17.0.9_9-jdk-jammy stages: - build - test @@ -15,7 +15,7 @@ variables: MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dmaven.artifact.threads=10" MAIN_BRANCH: "main" RELEASE_BRANCH: "release" - CLI_PATH: "/disks/data01/wildfly/wildfly-25.0.1.Final/bin" + CLI_PATH: "/disks/data01/wildfly/wildfly-26.1.3.Final/bin" TMP_PATH: "/home/deployer/gitlab_tmp" DEPLOYMENT_PATH: "/home/wildfly/deployments" ARCHIVE_PATH: "/home/wildfly/archive" @@ -25,6 +25,7 @@ cache: - .m2/repository/ before_script: + - apt-get update && apt-get install -y git - git config --global user.name "${GITLAB_USER_NAME}" - git config --global user.email "${GITLAB_USER_EMAIL}" - echo "Get common settings" @@ -33,8 +34,8 @@ before_script: - cp $SETTINGS_XML ../$SETTINGS_XML - cd .. - rm -rf $COMMON_CONFIG_LOCAL - - apt-get update -y && apt-get install -y python && apt-get install -y rsync openssh-client - - "python build_pom_with_models.py" + - apt-get update -y && apt-get install -y python3 && apt-get install -y rsync openssh-client + - "python3 build_pom_with_models.py" build: stage: build diff --git a/README.md b/README.md index c9b7feb3679c2e922489b235c3d97d5155334212..1e3fbebcf2b57e208efaff4ca8b8ea78226ba005 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,11 @@ $ mvnw.cmd clean install **PLEASE NOTE that this builds the package without any models. See "Adding models" below for more information** -Download and install [WildFly](https://www.wildfly.org/) >= 25.0.1 +Download and install [WildFly](https://www.wildfly.org/) == 26.1.3 Deploy the build from this project in Wildfly. -Wildfly should run on Java >= 11 +Wildfly should run on Java >= 17 ### Adding models @@ -59,6 +59,17 @@ To build with your preferred set of models, create a new file called e.g. `my_mo $ build_with_models.py my_models.xml ``` +To create Maven `<dependencies/>` XML with the latest versions of all models on NIBIO's GitLab, use the `build_models_xml.py` script, like this: + +```bash +# Write latest production version dependency elements XML to my_models.xml +$ ./build_models_xml.py > my_models.xml + +# Write latest SNAPSHOT version dependency elements XML to my_models.xml +$ ./build_models_xml.py -s > my_models.xml + +``` + ## Implement a model See [implement_model.md](./docs/implement_model.md) diff --git a/build_models_xml.py b/build_models_xml.py new file mode 100755 index 0000000000000000000000000000000000000000..b9459940c2421a7b9be906df103a04c0fb5d703c --- /dev/null +++ b/build_models_xml.py @@ -0,0 +1,87 @@ +#!/usr/bin/python3 + +''' +Copyright (C) 2023 NIBIO + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +@author Tor-Einar Skog <tor-einar.skog@nibio.no> +''' + +# Fetches the package registry list from our GitLab, +# filters only models packages, +# figures out which is the newest version of each package, +# creates Maven dependencies XML stubs +# dumps to stdout +# Example usage: +# $ ./build_models_xml.py -s > models.xml + +import sys +import requests +import xml.etree.ElementTree as ET + +if len(sys.argv) == 2 and sys.argv[1] == "-h": + print("""usage: build_with_models [-s]""") + exit(0) + +# Use the -s option to fetch only SNAPSHOT versions +snapshot = True if len(sys.argv) == 2 and sys.argv[1] == "-s" else False + +url = "https://gitlab.nibio.no/api/v4/projects/401/packages?per_page=100&order_by=version&sort=desc" + +all_packages = [] + +response = requests.get(url) + +if response.status_code == 200: + # Get the first page contents + data = response.json() + all_packages.extend(data) + # Iterate the next pages + while 'next' in response.links: + next_url = response.links["next"]["url"] + response = requests.get(next_url) + if response.status_code == 200: + data = response.json() + all_packages.extend(data) + + +models = {} + +model_prefixes = ["no/nibio/vips/model","fi/luke/vips/model"] + +# Filter models and store only the most recent version (highest alphanumeric number) +for package in all_packages: + for model_prefix in model_prefixes: + if package["name"].find(model_prefix) >=0 and ((snapshot and package["version"].find("SNAPSHOT")>=0) or (not snapshot and package["version"].find("SNAPSHOT")<0)): + model_name = package["name"][len(model_prefix) + 1:] + if models.get(model_name, None) == None: + models[model_name] = {} + models[model_name]["groupId"] = model_prefix.replace("/",".") + models[model_name]["version"] = package["version"] + else: + models[model_name]["version"] = package["version"] if package["version"] > models[model_name]["version"] else models[model_name]["version"] + +# Build partial Maven XML +dependencies = ET.Element("dependencies") +for model_name, value in models.items(): + dependency = ET.SubElement(dependencies, "dependency") + ET.SubElement(dependency,"groupId").text = value["groupId"] + ET.SubElement(dependency, "artifactId").text = model_name + ET.SubElement(dependency, "version").text = value["version"] + +# Dumps the indented XML to stdout +tree = ET.ElementTree(dependencies) +ET.indent(tree, space="\t",level=0) +ET.dump(tree) diff --git a/models.xml b/models.xml index d9aa6a0cf7acd9c2e2e7b8afc9c8c6f30584f194..b2cb61daee1ce199c6676f035ad3ab2fe4497af0 100644 --- a/models.xml +++ b/models.xml @@ -1,112 +1,112 @@ <dependencies> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>AlternariaModel</artifactId> - <version>1.1.4</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>AppleScabModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>BarleyNetBlotchModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>BremiaLactucaeModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>DeliaRadicumModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>DeliaRadicumFloralisObservationModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>DOWNCASTModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>fi.luke.vips.model</groupId> - <artifactId>FinnCerealModels</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>GrassDryingModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>LygusRugulipennisModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>MamestraBrassicaeModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>Model_LEAFBLOTCH</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>Model_MAIZEPHENO</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>NaerstadModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>NegativePrognosisModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>OatFloweringModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>PsilaRosaeObservationModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>PsilaRosaeTempModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>RoughageNutritionModel</artifactId> - <version>1.1.5</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>SeptoriaApiicolaModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>SeptoriaHumidityModel</artifactId> - <version>1.1.3</version> - </dependency> - <dependency> - <groupId>no.nibio.vips.model</groupId> - <artifactId>SeptoriaReferenceHumidityModel</artifactId> - <version>1.1.3</version> - </dependency> -</dependencies> \ No newline at end of file + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>RoughageNutritionModel</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>AlternariaModel</artifactId> + <version>1.1.6</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>BarleyNetBlotchModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>AppleScabModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>DeliaRadicumModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>DeliaRadicumFloralisObservationModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>BremiaLactucaeModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>fi.luke.vips.model</groupId> + <artifactId>FinnCerealModels</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>DOWNCASTModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>LygusRugulipennisModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>GrassDryingModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>Model_LEAFBLOTCH</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>NaerstadModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>MamestraBrassicaeModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>Model_MAIZEPHENO</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>OatFloweringModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>NegativePrognosisModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>PsilaRosaeObservationModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>PsilaRosaeTempModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>SeptoriaHumidityModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>SeptoriaReferenceHumidityModel</artifactId> + <version>1.1.5</version> + </dependency> + <dependency> + <groupId>no.nibio.vips.model</groupId> + <artifactId>SeptoriaApiicolaModel</artifactId> + <version>1.1.4</version> + </dependency> +</dependencies> diff --git a/pom.xml b/pom.xml index f2b3c928cb048d26c04367c2162cac108ff703b7..56322f4cc69fed7628d22887f437ac43433198ad 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <groupId>no.nibio</groupId> <artifactId>VIPSCore</artifactId> <packaging>war</packaging> - <version>2.0.4</version> + <version>2.0.5-SNAPSHOT</version> <name>VIPSCore</name> <url>http://maven.apache.org</url> @@ -32,7 +32,7 @@ <dependency> <groupId>io.github.classgraph</groupId> <artifactId>classgraph</artifactId> - <version>4.8.162</version> + <version>4.8.165</version> </dependency> <dependency> <groupId>com.thetransactioncompany</groupId> @@ -48,7 +48,7 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.13.1</version> + <version>2.16.1</version> <type>jar</type> </dependency> <dependency> @@ -60,7 +60,7 @@ <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> - <version>2.13.1</version> + <version>2.16.1</version> <type>jar</type> </dependency> <dependency> @@ -77,7 +77,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.1</version> + <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> @@ -88,7 +88,7 @@ <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> - <version>1.2</version> + <version>1.3.0</version> <scope>provided</scope> </dependency> <dependency> @@ -106,7 +106,7 @@ <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> - <version>1.7</version> + <version>1.8.0</version> <type>jar</type> </dependency> <dependency> @@ -123,13 +123,13 @@ <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> - <version>3.8.0</version> + <version>3.10.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> - <version>1.15</version> + <version>1.16.0</version> </dependency> <dependency> <groupId>com.googlecode.json-simple</groupId> @@ -143,7 +143,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> + <version>3.12.1</version> <configuration> <source>11</source> <target>11</target> @@ -152,7 +152,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.3.1</version> + <version>3.6.3</version> <configuration> <tags> <tag> @@ -167,8 +167,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-wrapper-plugin</artifactId> - <version>3.1.1</version> + <version>3.2.0</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>3.4.0</version> + </plugin> + </plugins> </build> </project> diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000000000000000000000000000000000000..7b1272e1ef0afce5b3b143a628c6f8cb36ca9fe8 --- /dev/null +++ b/renovate.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "baseBranches": ["renovate-updates"] +}