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
And in order to make those config files generate at the project root, you need to enable java.import.generatesMetadataFilesAtProjectRoot. Remember update this setting at WORKSPACE scope, so that it won't affect your other projects.
Thank you Sheng Chen (@jdneo) for the reply. I followed the steps mentioned in redhat-developer/vscode-java#1263 (comment) but it is not working for me. Can I look at some logs to confirm whether my Test Runner is picking up the right maven profile to execute the test?
Test Runner does not know which profile it is running towards.
The way how it works is:
The Java Language Server will import the maven project using m2e, which converts the Maven project to an internal project model representation. So it's the m2e needs the profile name and import it correctly. When you run a test, Test Runner ask Java Language Server for information like classpath, and run it.
What kind of configuration are you changing in your test profile?
Sheng Chen (@jdneo) We have catergorized tests as per the enviroment and we initialize those enviroment as per the profile setting.
For example, we have a profile for long run tests which instantiates db schema as per the test requirement. We also have enviroment variables which get set as per the profile.
I see. I'm afraid it's not supported right now. You have to manually run the long running tests. We environment variable, currently you can set it via the java.test.config setting.
I see. That's properties, I was thought about env variable before. Sorry for the confusion. The java.test.config does not allow to customize properties.
BTW, Is it possible to share a minimal sample project? I would like to use that to check where is the gap.
Sheng Chen (@jdneo) I will try to put up something.
BTW, Just assume that the properties defined above can be exported to env variables. What about other plugin goals "refresh". How can I make the test execute this goal before running the test?
Thank you for giving the time.
Hi Rajesh Mohanty (@ramoh), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
To run tests under a specific Maven profile, include the -P flag when invoking Maven. For example:
mvn test -P my-profile
Or target a specific goal/plugin:
mvn groupId:artifactId:goal -P profile-1,profile-2
References:
Configure maven profiles: use mvn … -P profile-1,profile-2,…
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
Activity
jdneo commentedon Dec 3, 2023
Technically, it's doable. But it's not convenient.
The key is to let the Java Language Server import the project using the target profile. See: redhat-developer/vscode-java#1263 (comment)
And in order to make those config files generate at the project root, you need to enable
java.import.generatesMetadataFilesAtProjectRoot. Remember update this setting atWORKSPACEscope, so that it won't affect your other projects.ramoh commentedon Dec 4, 2023
Thank you Sheng Chen (@jdneo) for the reply. I followed the steps mentioned in redhat-developer/vscode-java#1263 (comment) but it is not working for me. Can I look at some logs to confirm whether my Test Runner is picking up the right maven profile to execute the test?
jdneo commentedon Dec 4, 2023
Test Runner does not know which profile it is running towards.
The way how it works is:
The Java Language Server will import the maven project using m2e, which converts the Maven project to an internal project model representation. So it's the m2e needs the profile name and import it correctly. When you run a test, Test Runner ask Java Language Server for information like classpath, and run it.
What kind of configuration are you changing in your test profile?
ramoh commentedon Dec 4, 2023
Sheng Chen (@jdneo) We have catergorized tests as per the enviroment and we initialize those enviroment as per the profile setting.
For example, we have a profile for long run tests which instantiates db schema as per the test requirement. We also have enviroment variables which get set as per the profile.
jdneo commentedon Dec 5, 2023
I see. I'm afraid it's not supported right now. You have to manually run the long running tests. We environment variable, currently you can set it via the
java.test.configsetting.ramoh commentedon Dec 5, 2023
Hi Sheng Chen (@jdneo) I have the following profile defined in my parent POM.xml . How can I configure this using
java.test.configjdneo commentedon Dec 5, 2023
I see. That's properties, I was thought about env variable before. Sorry for the confusion. The
java.test.configdoes not allow to customize properties.BTW, Is it possible to share a minimal sample project? I would like to use that to check where is the gap.
ramoh commentedon Dec 5, 2023
Sheng Chen (@jdneo) I will try to put up something.
BTW, Just assume that the properties defined above can be exported to env variables. What about other plugin goals "refresh". How can I make the test execute this goal before running the test?
Thank you for giving the time.
jdneo commentedon Dec 6, 2023
I guess you can use the
preLaunchTask: Define a task to runrefreshbefore test execution.github-actions commentedon Nov 12, 2025
Hi Rajesh Mohanty (@ramoh), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
To run tests under a specific Maven profile, include the
-Pflag when invoking Maven. For example:mvn test -P my-profile
Or target a specific goal/plugin:
mvn groupId:artifactId:goal -P profile-1,profile-2
References:
mvn … -P profile-1,profile-2,…The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
kgskgs commentedon Jan 21, 2026
This is essential when running maven tests