You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarification on expected behaviour for microprofile-config.properties file in webapp directory #182
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.
Suggestions are only available when the file is placed under resources/META-INF.
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.
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.
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.
@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.
@TrevCraw before developping something it should be really nice to ask to MicroProfile specification team a clear specification about this location file.
@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?
@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.
@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?
@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.
Activity
anusreelakshmi934 commentedon Apr 10, 2024
I attempted to use
Quarkus Toolsbut 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.angelozerr commentedon Apr 10, 2024
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.
TrevCraw commentedon Apr 11, 2024
@angelozerr As far as I can tell from the MicroProfile specification, I don't see anything specifying a valid location for
microprofile-config.propertiesinsrc. I only see theMETA-INF/microprofile-config.propertieslocation specified for when the application is built.However, I do not know the spec very well, so maybe there is somewhere where the valid
srclocations formicroprofile-config.propertiesare defined and I have not found it. It seems as though a user may be able to have amicroprofile-config.propertiesfile in any location insrcas long as the project build tool handles copying it to the right location for the application build.angelozerr commentedon Apr 11, 2024
@TrevCraw before developping something it should be really nice to ask to MicroProfile specification team a clear specification about this location file.
TrevCraw commentedon Apr 16, 2024
@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.propertiesfile should be located in thesrcof a project?@angelozerr How was it determined that the
src/main/resources/META-INFlocation should be supported?angelozerr commentedon Apr 16, 2024
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
vscode-microprofile/package.json
Line 35 in 890fbb0
But perhaps I miss some part of code, it requires some investigation. Any PR are welcome!
Emily-Jiang commentedon Apr 16, 2024
@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 atWEB-INF/classes/META-INF/microprofile-config.properties.TrevCraw commentedon Apr 29, 2024
@angelozerr It appears that the location
src/main/resourcesmay 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 theirpom.xmlto pull resources from other locations: https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html.TrevCraw commentedon Apr 29, 2024
@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.propertiesfile located in their project source code?angelozerr commentedon Apr 29, 2024
@TrevCraw if I remember we hard code the META-INF folder but not the src/main/resources folder which is get by jdt api
Emily-Jiang commentedon Apr 29, 2024
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.