How to disable pom.xml validation in IntelliJ IDEA

With respect, none of SkyWalkers solutions worked for me.

But the following one worked for me:

Simply add this above the property lines:

<!--suppress UnresolvedMavenProperty -->

So you'll end up with:

<!--suppress UnresolvedMavenProperty -->
<git.version>${git.commit.time}.${git.commit.id.abbrev}</git.version>

Yeah, that looks broken

Interesting. I've tested this behavior in both IntelliJ IDEA Ultimate 14.1.7 as well as IntelliJ IDEA Community 2016.1.2, and properties that IDEA doesn't know about still show as red even with all Maven inspections turned off. This looks to be a bug (or to put it more charitably, an unimplemented feature) in IDEA, that the error it gives when it can't identify a property isn't controlled by the inspections settings.

There are a couple related issues in IDEA's bug tracker:

  • IDEA-96358: Maven: cannot resolve environment variables
  • IDEA-100272: Maven: support for implicit properties

There's also a post on a similar issue on the JetBrains support forum:

  • 'Cannot resolve symbol' in my Maven POM file for @VAR@ property values

A possible workaround

There's a workaround listed in both the comments of IDEA-96358 as well as in the support post. You can add a dummy version of your dynamic properties in Settings / Build, Execution, Development / Build Tools / Maven / Runner / Properties, like in this screenshot: Screenshot of setting Maven Runner Properties

Putting values in there will let IDEA know about them so it will not highlight them in red. However, I found in my testing that since IDEA was passing the values as properties to Maven, they weren't getting overwritten by the buildnumber-plugin and I was seeing my dummy value instead when I tried to use it. (The only way I tested using it was in a maven-help-plugin evaluate goal, but perhaps it works when using it in other ways?) In order to be able to use the dynamically-set value, in my specific build configuration I unchecked the "Use project settings" box and removed the dummy property, as in this screenshot: Screenshot of removing property from specific build configuration

This is starting to be quite an annoying workaround, as if you have a lot of Maven build configurations and like the ability for them all to default to the same runner settings, you'd now have to duplicate the "real" setup you want in each configuration, and have the default in the project settings dialog just be for the "dummy" values so that IDEA knows that it shouldn't treat referencing that property as an error. This also requires you to run all your Maven commands via build configurations, and not via other means like double-clicking lifecycles in the "Maven Projects" tool window. Though if you have few build configurations, those are the only way you run Maven from within IDEA, and the color red when editing your pom.xml file is annoying you enough, perhaps this workaround is an acceptable tradeoff for you.

Further steps

As it appears that IDEA's built-in functionality doesn't really cover dynamically-generated properties, I think the only real way to fix it is to convince JetBrains to do it, unless there's some way to add the functionality in a third-party plugin (which is now very much getting beyond my expertise). I'd suggest either voting for and commenting on one of the tickets in JIRA's tracking system I mentioned, or creating your own if you think your issue is different enough (which it may be). Also, you may want to contact JetBrains support, particularly if you have a paid subscription with them. While I suspect that they have many priorities to work on (as do we all), I also suspect that more people asking for something increases the chance of it moving toward the top of their backlog. Asking nicely for something rarely hurts.