Skip to content
Snippets Groups Projects
Commit 71479aa6 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Include all current models, add to README

parent 29f44445
No related branches found
No related tags found
1 merge request!7Gnuaffero
Pipeline #1597 failed
......@@ -8,3 +8,4 @@ jboss/
/.idea/
.vscode/settings.json
.settings/org.eclipse.core.resources.prefs
pom_with_models.xml
......@@ -26,6 +26,8 @@ or on Windows
$ 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
Deploy the build from this project in Wildfly.
......@@ -33,36 +35,22 @@ Deploy the build from this project in Wildfly.
Wildfly should run on Java >= 11
### Adding models
To add models, create this folder in WildFly:
`[WILDFLY_ROOT]/modules/no/nibio/vips/modelcontainer/main/`
Add the model jar file, and edit module.xml accordingly.
``` xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
&copy; 2019 NIBIO
Author: Tor-Einar Skog <tor-einar.skog@nibio.no>
-->
<module xmlns="urn:jboss:module:1.1" name="no.nibio.vips.modelcontainer">
<resources>
<resource-root path="PsilaRosaeTempModel-1.0-SNAPSHOT.jar"/>
</resources>
<dependencies>
<module name="no.nibio.vips.VIPSCommon" export="false"/>
<module name="com.fasterxml.jackson.core.jackson-core" export="false"/>
<module name="com.fasterxml.jackson.core.jackson-databind" export="false"/>
<module name="com.vividsolutions.jts" export="false"/>
<module name="org.renjin" export="false"/>
<module name="org.slf4j" export="false"/>
</dependencies>
</module>
Models are listed as dependencies in the POM and built into the WARfile. In order to make it possible
to configure your own set of models to include, we have separated the model dependencies out in a
separate file. The default is `models.xml`, and contains the models that VIPS in Norway are using
currently.
To build the package with the default set of models, run
```bash
$ build_with_models.py
```
You also need to make sure you have the dependency modules available.
To build with your preferred set of models, create a new file called e.g. `my_models.xml` and run
```bash
$ build_with_models.py my_models.xml
```
## Implement a model
See [implement_model.md](./docs/implement_model.md)
......
#!/usr/bin/python3
'''
Merges pom.xml and models.xml (default) into pom_with_models.xml and
runs mvn clean install -f pom_with_models.xml
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>
'''
import sys
from xml.dom.minidom import parse, parseString
import subprocess
from xml.dom.minidom import parse
# Default
models_xml_path = "models.xml"
merged_pom_filename = "pom_with_models.xml"
# Accept alternative models.xml file
if len(sys.argv) > 1:
models_xml_path = sys.argv[1]
pom_file = open("pom.xml")
models_file = open(models_xml_path)
pom_dom = parse(pom_file)
models_dom = parse(models_file)
# Read contents
pom_dom = parse("pom.xml")
try:
models_dom = parse(models_xml_path)
except FileNotFoundError:
print("ERROR: File %s not found." % models_xml_path)
exit(1)
pom_deps_element = pom_dom.getElementsByTagName("dependencies")
# Merge the dependency elements from models.xml into pom.xml
pom_deps_element = pom_dom.getElementsByTagName("dependencies")[0]
model_dep_elements = models_dom.getElementsByTagName("dependency")
for dep in model_dep_elements:
pom_deps_element.append(dep)
pom_deps_element.appendChild(dep)
print(pom_dom.toprettyxml())
# Write the modified pom dom to file
pom_with_models_file = open(merged_pom_filename,"w")
pom_dom.writexml(pom_with_models_file)
pom_with_models_file.close()
models_file.close()
pom_file.close()
# Build VIPSCore with Maven, using the merged pom
subprocess.run("./mvnw clean install -f %s" % merged_pom_filename, shell=True)
<dependencies>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>BremiaLactucaeModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>PsilaRosaeTempModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>AlternariaModel</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>AppleScabModel</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>BarleyNetBlotchModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>BremiaLactucaeModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips</groupId>
<artifactId>DeliaRadicumModel</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>DeliaRadicumFloralisObservationModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>DOWNCASTModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>fi.luke.vips.model</groupId>
<artifactId>FinnCerealModels</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips</groupId>
<artifactId>GrassDryingModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>LygusRugulipennisModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>MamestraBrassicaeModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.model</groupId>
<artifactId>Model_LEAFBLOTCH</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>no.nibio.model</groupId>
<artifactId>Model_MAIZEPHENO</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>NaerstadModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>NegativePrognosisModel</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>OatFloweringModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>PsilaRosaeObservationModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>PsilaRosaeTempModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>RoughageNutritionModel</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>no.bioforsk.vips.model</groupId>
<artifactId>SeptoriaApiicolaModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>SeptoriaHumidityModel</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>SeptoriaReferenceHumidityModel</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
\ No newline at end of file
<!-- Example alternative list of model dependencies. Copy and use according to README.md -->
<dependencies>
<dependency>
<groupId>no.nibio.vips.model</groupId>
......
......@@ -161,7 +161,7 @@
<name>copyright</name>
<!-- copyright tag for classes and interfaces -->
<placement>t</placement>
<head>&copy; Copyright</head>
<head>Copyright</head>
</tag>
</tags>
</configuration>
......
......@@ -22,6 +22,8 @@ along with VIPSCore. If not, see <http://www.nibio.no/licenses/>.
<dependencies>
</dependencies>
<exclusions>
<module name="org.jboss.resteasy.resteasy-json-binding-provider"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment