Skip to content

Clarification on expected behaviour for microprofile-config.properties file in webapp directory #182

Open

Description

@anusreelakshmi934

Currently, it seems that the LSP4MP language server does not provide suggestions for the microprofile-config.properties file when it is located under the webapp/META-INF directory.
image

Suggestions are only available when the file is placed under resources/META-INF.
image

Related - #249

Tools for MicroProfile Version: v0.11.0
OS: Mac
Steps to Reproduce:
Place microprofile-config.properties under webapp directory.
Open VSCode and try to access suggestions for properties within the microprofile-config.properties file.

Activity

  1. anusreelakshmi934 commented on Apr 10, 2024

    @anusreelakshmi934
    Author

    I attempted to use Quarkus Tools but found that snippet suggestions were not appearing in both VSCode and Eclipse when working within the Webapp directory. However, I did receive suggestions under the resources directory. Interestingly, in IntelliJ, I received suggestions regardless of the location I was working in.

  2. angelozerr commented on Apr 10, 2024

    @angelozerr
    Contributor

    We need to support this usecase but have you a link to the MicroProfile specification which says that webapp folder is a valid folder for microprofile-config.properties please.

  3. TrevCraw commented on Apr 11, 2024

    @TrevCraw

    @angelozerr As far as I can tell from the MicroProfile specification, I don't see anything specifying a valid location for microprofile-config.properties in src. I only see the META-INF/microprofile-config.properties location specified for when the application is built.

    However, I do not know the spec very well, so maybe there is somewhere where the valid src locations for microprofile-config.properties are defined and I have not found it. It seems as though a user may be able to have a microprofile-config.properties file in any location in src as long as the project build tool handles copying it to the right location for the application build.

  4. angelozerr commented on Apr 11, 2024

    @angelozerr
    Contributor

    @TrevCraw before developping something it should be really nice to ask to MicroProfile specification team a clear specification about this location file.

  5. TrevCraw commented on Apr 16, 2024

    @TrevCraw

    @yeekangc @Emily-Jiang Would either of you be able to speak to whether or not there are MicroProfile specifications that define where a microprofile-config.properties file should be located in the src of a project?

    @angelozerr How was it determined that the src/main/resources/META-INF location should be supported?

  6. angelozerr commented on Apr 16, 2024

    @angelozerr
    Contributor

    @angelozerr How was it determined that the src/main/resources/META-INF location should be supported?

    If I remember it is hard-coded and managed at https://github.com/eclipse/lsp4mp/blob/8e53e583508cc4d141482a55046cfd76a0362092/microprofile.jdt/org.eclipse.lsp4mp.jdt.core/src/main/java/org/eclipse/lsp4mp/jdt/internal/core/providers/MicroProfileConfigSourceProvider.java#L49

    And I think there are this behavior on vscode client side

    "workspaceContains:**src/main/resources/META-INF/microprofile-config.properties",

    But perhaps I miss some part of code, it requires some investigation. Any PR are welcome!

  7. Emily-Jiang commented on Apr 16, 2024

    @Emily-Jiang

    @yeekangc @Emily-Jiang Would either of you be able to speak to whether or not there are MicroProfile specifications that define where a microprofile-config.properties file should be located in the src of a project?

    @angelozerr How was it determined that the src/main/resources/META-INF location should be supported?

    @TrevCraw The file microprofile-config.properties is under META-INF and the path can be load by the app classloader using the path: META-INF/microprofile-config.properties. See here for details. For a war achive, the file would be at WEB-INF/classes/META-INF/microprofile-config.properties.

  8. TrevCraw commented on Apr 29, 2024

    @TrevCraw

    @angelozerr It appears that the location src/main/resources may have been chosen since it is the default location for a project's resources when working with Maven. However, it should be noted that users can easily customize their pom.xml to pull resources from other locations: https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html.

  9. TrevCraw commented on Apr 29, 2024

    @TrevCraw

    @Emily-Jiang Thank you for your response. My understanding is that what you outlined applies to the built application (please correct me if I am wrong). Is there anything in the MP specifications that dictates where a user must have their microprofile-config.properties file located in their project source code?

  10. angelozerr commented on Apr 29, 2024

    @angelozerr
    Contributor

    @TrevCraw if I remember we hard code the META-INF folder but not the src/main/resources folder which is get by jdt api

  11. Emily-Jiang commented on Apr 29, 2024

    @Emily-Jiang

    @Emily-Jiang Thank you for your response. My understanding is that what you outlined applies to the built application (please correct me if I am wrong). Is there anything in the MP specifications that dictates where a user must have their microprofile-config.properties file located in their project source code?

    The spec does not say where in the project it should be placed. It varies based on different projects. It will be fine as long as in the binary it ends up under META-INF/microprofile-config.properties where it can be loaded by the classloader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions