Make Magnolia bugs reproducable for Magnolia support, with as little project code as possible
Generated from Magnolia's project and module archetypes, with Magnolia Community Edition used in the POM, and then added a JUnit5 integration-test with IBM iX' MagnoliaTomcatExtension.
That test is supposed to make Magnolia bugs reproducable for Magnolia support, with as little project code as possible.
Build results in a webapp that can be deployed e.g. to Tomcat.
From the top-level Maven project:
mvn package
This results in a WAR file + exploded WAR folder in reproducer-webapp/target
.
In order to build a Docker OCI image with Tomcat to run the webapp, cd
to reproducer-webapp
and issue:
podman build --build-arg SOURCE_WAR_EXPLODED=target/reproducer-webapp-1.0-SNAPSHOT/ -t magnolia-reproducer .
To run the Docker image, issue:
podman run -it -p 8080:8080 magnolia-reproducer
This only runs the webapp as Docker/OCI image, without running any tests.
To run the AuthorTomcatTest
as a Maven integration-test:
mvn verify
IBM iX' MagnoliaTomcatExtension expects the name of the WAR to be passed in using the system property project.build.finalName
. This is what the webapp's POM does in ./reproducer-webapp/pom.xml, using the value of the Maven pre-defined variable.
You can find out the expected value like this:
mvn help:evaluate -Dexpression=project.build.finalName
In this project, the system property project.build.finalName
is defined here (as the MagnoliaTomcatExtension cannot read Maven variables): https://github.com/IBM/magnolia-reproducer/blob/main/reproducer-webapp/pom.xml#L138
E.g. in Eclipse, this can be done by passing -Dproject.build.finalName=reproducer-webapp-1.0-SNAPSHOT
as a VM argument:
In VSCode, add the following to your settings.json
:
"java.test.config": [
{
"name": "AuthorTomcatTestConfig",
"workingDirectory": "${workspaceFolder}/reproducer-webapp",
"vmArgs": [
"-Dlog4j.config=WEB-INF/config/reproducer-log4j2.xml",
"-Dproject.build.finalName=reproducer-webapp-1.0-SNAPSHOT"
],
}
]