Open scottkurz opened 9 months ago
This issue to me suggests an idea I've considered now and again, which is to give 'deploy' its own special skipDeploy parm.
Besides perhaps working around this issue... it might be more generally useful dealing with SpringBoot since we have both the original WAR and SB plugin-repackaged WAR.
In the meantime we can always configure our own skip in the dev/run goals with:
<execution>
<id>deploy-skip</id>
<phase>none</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
Summary of discussion at meeting held on 11/07/24 for this issue:
springBootApplication
elements similar to how we look for application
, webApplication
and enterpriseApplication
today in ServerConfigDocument class in ci.common. springBootApplication
element is found, we should throw an error since the Liberty runtime will fail in this instance.springBootApplication
element is found, save the location value in a separate field and provide a getter method for it since we will need it in both LMP and LGP to deploy the application properly.springBootApplication
element with a location attribute was found in ci.common.apps
or dropins/spring
folder, use the value from the location attribute for the file name in the destination.@scottkurz @tjwatson Please correct me if I got any of that wrong.
In LMP/LGP, when copying over the thinned application to either the apps or dropins/spring folder, use the value from the location attribute for the file name in the destination.
When there is a <springBootApplication/>
configuration found it would be an error to copy the thinned app to dropins/spring
folder. I suspect that should be flagged as an error if the <appsDirectory>apps</appsDirectory>
plugin configuration is not being used.
This is from our documentation:
The server's apps or dropins directory where the application files should be copied. The default value is set to apps if the application is defined in the server configuration, otherwise it is set to dropins.
So we automatically set it to apps
when we find the application configured in the server configuration. Need to make sure we do the same for springBootApplication
. We don't currently.
On a related note we also flag it as an error if you configure LMP to use "dropins" but have app config in server.xml (search for:
throw new MojoExecutionException(messages.getString("error.install.app.dropins.directory"));
so we should do similar things.
For a deployment of a SpringBoot packaged app, with liberty-maven-plugin config:
I can't specify server.xml config like:
The deploy will, by default, just go into dropins/spring unlike the deployment of regular (non-SB) WAR/EAR packages, in which the default path is calculated based on whether there is any app deployment configuration detected in server.xml config.
If I explicitly configure liberty-maven-plugin to use the 'apps' directory for deploy:
it will always generate a config dropin. It will likewise not look for a springBootApplication at a matching location.
Though we have tests for each type of generated config, I don't think we test with explicitly-provided config in server.xml.
CONSEQUENCE
Depending on the values specified, this could surface with messages like:
OR
More directly, the config the user intends to set from the
<springBootApplication>
element https://openliberty.io/docs/latest/reference/config/springBootApplication.html won't take effect.WORKAROUND
Use this LMP config:
Do a
mvn package liberty:create liberty:deploy
just to generate the deployment configDropin.Take the generated config dropin and look at the contents, e.g.
cat configDropins/defaults/install_apps_configuration_1491924271.xml
to see something like:By matching the generated id, location and name in the explicit config in server.xml, we can cleanly merge over the config dropin-generated app config, and use what's specified in server.xml
PROPOSAL
It seems the most obvious thing is to follow the same pattern used for WAR/EAR deployment, as mentioned previously.
A couple other notes:
<stripVersion>true</stripVersion>
config.