Open anusreelakshmi934 opened 7 months ago
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?
@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 https://github.com/redhat-developer/vscode-microprofile/blob/890fbb0a6d0bc16669bc71477485f4e8d0e6cde5/package.json#L35
But perhaps I miss some part of code, it requires some investigation. Any PR are welcome!
@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 thesrc
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
.
@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.
@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?
@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 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.
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
.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.