Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liberty:install-feature - variable-based defined includes are not resolved correctly #1860

Open
LarsBesselmann opened this issue Jan 21, 2025 · 2 comments · May be fixed by OpenLiberty/ci.common#469
Assignees

Comments

@LarsBesselmann
Copy link

LarsBesselmann commented Jan 21, 2025

It seems that the Liberty maven plugin does not handle default values for includes correctly during liberty:install-feature.
In liberty:install-feature, the variable-based defined includes in server.xml are only resolved correctly when the variable is defined in the bootstrap.properties.

Here the details:
Next to the server.xml, I created two files basic.xml and ldap.xml in the ${server.config.dir}/includes directory.
In my server.xml, I defined the include like this:

<variable name="AUTH_TYPE"  defaultValue="basic"/>
<include optional="false" location="${server.config.dir}/includes/${AUTH_TYPE}.xml"/>

If I define in the bootstrap.properties file the variable "AUTH_TYPE=basic" everything works fine:
mvn io.openliberty.tools:liberty-maven-plugin:dev -f "c:\myWork\WCA\vscode\Liberty-JakartaEE-mvn\pom.xml"
[INFO] Running liberty:create
[INFO] Running liberty:install-feature
...
[INFO] Parsing the server file for features and includes: defaultServer\server.xml
[INFO] Parsing the server file for features and includes: defaultServer\includes/basic.xml
[INFO] Features were included for file C:\myWork\WCA\vscode\Liberty-JakartaEE-mvn\target\liberty\wlp\usr\servers\defaultServer\includes\basic.xml

But if I do not define the variable AUTH_TYPE in the bootstrap.properties file, the liberty:install-feature does not use the default value but complains that the include file cannot be parsed:
mvn io.openliberty.tools:liberty-maven-plugin:dev -f "c:\myWork\WCA\vscode\Liberty-JakartaEE-mvn\pom.xml"
[INFO] Running liberty:create
[INFO] Running liberty:install-feature
...
[INFO] Parsing the server file for features and includes: defaultServer\server.xml
[WARNING] Unable to parse include file ${server.config.dir}/includes/${AUTH_TYPE}.xml. Skipping the included features.
...
[INFO] Running liberty:deploy
[INFO] [AUDIT ] CWWKG0028A: Processing included configuration resource: C:\myWork\WCA\vscode\Liberty-JakartaEE-mvn\target\liberty\wlp\usr\servers\defaultServer\includes\basic.xml

Environment:
--- liberty-maven-plugin:3.11.2 (edited)

@arunvenmany-ibm
Copy link
Contributor

arunvenmany-ibm commented Jan 21, 2025

@cherylking

Currently we are not handling the logic to do variable resolution for included location while installing features

@cherylking
Copy link
Member

@arunvenmany-ibm Can you verify that the Liberty server itself resolves the variable for the include location when installing features? We want our plugin to mimic what the Liberty server does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants