Visual Studio Code (and Eclipse) Gotchas

It has been some times that I am revisiting some Java + Spring action. I am using maven (not gradle). Here, I am going to rant about the Visual Studio Code (vscode) gotchas. 

First, maven profile set in maven plug-in is not honored by the java plug-in. It is well documented here, https://github.com/microsoft/vscode-maven/issues/117

There are only two ways to make it work. The first way to make it work is to meticulously changing activationByDefault tags from false to true or vice versa in pom.xml. It is a very error-prone method especially when we have multiple profiles. The second is to have a settings.xml, where we put activeProfiles tag, in the project directory and have the workspace overwrites .m2/settings.xml (the user default) with that settings.xml through: java.configuration.maven.userSettings properties.

As you may notice, both of them are not optimum. There comes a decision whether to have settings.xml in the Version Control System (vcs). It is a headache as it is against basic principles to include IDE setup (such as .project etc.) in the VCS. 

Second, when one include a maven module with a profile, the classifier tag is not honored by the vscode's spring boot run (or debug). It gives me a very ugly exception called sun.reflect.annotation.TypeNotPresentExceptionProxy, which gives me no clue of what is happening. I have to kick out the classifier tag to make it work. It is so strange. 

I guess these two problems are related because both concerns with maven profiles.

Actually, vscode uses the java plugin code-base for Eclipse. So, by extension this rant also applies to Eclipse.

Logged on Doughnut I/O. U.E. 1587283596.

Comments