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

In liberty:create goal, liberty-plugin-config.xml doesn't reflect precedence of liberty.bootstrap.* props over <bootstrapPropertiesFile> plugin config #1788

Closed
scottkurz opened this issue Jan 25, 2024 · 2 comments · Fixed by #1792
Assignees

Comments

@scottkurz
Copy link
Member

scottkurz commented Jan 25, 2024

Using v3.10, with pom.xml property and plugin config like:

    <properties>
        <liberty.bootstrap.name>intro</liberty.bootstrap.name>
  ...
            <plugin>
                <groupId>io.openliberty.tools</groupId>
                <artifactId>liberty-maven-plugin</artifactId>

                <configuration>
                    <bootstrapPropertiesFile>${project.basedir}/src/main/liberty/config/c.properties</bootstrapPropertiesFile>

both the 'create' and 'deploy' goals will generate a 'bootstrap.properties' file from the liberty.bootstrap.name property. The <bootstrapPropertiesFile> config will be ignored.

However, if you look at the liberty-plugin-config.xml, the 'deploy' goal will write the correct, individual property, matching the generated 'bootstrap.properties' file:

    <bootstrapProperties>
        <name>intro</name>
    </bootstrapProperties>

while the 'create' goal will write:

    <bootstrapPropertiesFile>C:\ydosppa\application-stack-intro\src\main\liberty\config\c.properties</bootstrapPropertiesFile>

The reason seems to be that the precedence incorporating the liberty.bootstrap.* project props is encoded in the io.openliberty.tools.maven.server.StartDebugMojoSupport.copyConfigFiles() method, which gets called BEFORE the liberty-plugin-config.xml is written in the 'deploy' goal, but only gets called AFTER the plugin config is written in the 'create' goal.

From the doc, https://github.com/OpenLiberty/ci.maven/blob/main/docs/common-server-parameters.md, it doesn't specifically mention the liberty.bootstrap.* project props but it does say that plugin config parm <bootstrapProperties> takes precedence over <bootstrapPropertiesFile>, so the generated properties seem correct and the plugin cfg xml seems wrong.

In dev mode, a create then a deploy is typically done, so the practical impact of this may be almost zero today.

But as Liberty Tools (IDE support) adds more usage of the liberty-plugin-config.xml maybe this should be fixed.

I know this is a long writeup for possibly a 1-line change of writing the plugin cfg maybe after copyConfigFiles in the create goal... but wanted to make sure we understood clearly first :)

@cherylking
Copy link
Member

Thanks for the details Scott. Makes sense.

@cherylking
Copy link
Member

Make sure LGP does the right thing also when fixing this.

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

Successfully merging a pull request may close this issue.

3 participants