How to disable pom.xml validation in IntelliJ IDEA
Solution 1
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>
Solution 2
As it is working fine. I think it would be some cache or may be little bug which has no major effect giving some info. So I want to suggest you some options
Suggestion-1:
You can rebuild your project and then check
Build > Rebuild Project
Suggestion-2:
You can clear your ide's caches
File -> invalidate caches
- Then
Restart application
Suggestion-3:
Sometimes silly trick may solve the issue.
- Right click on the code editor
- Hover on Maven and expand
- Click on Reimport
Suggestion-4:
There are some ways to solve the issue and also discussion what is happening version to version. You can go through
IntelliJ inspection gives "Cannot resolve symbol" but still compiles code
Suggestion-5:
You can make a try Michał Wróbel's blog: Cannot resolve symbol XYZ in IntelliJ although maven builds sources properly
Suggestion-6:
You can also disable reading pom.xml
on every small changes in IntelliJ Idea:
Intellij IDEA and Maven, disable reading pom.xml on every small change, even without a save
Solution 3
Try File->Settings->Editor->Inspections->uncheck "Maven Model Inspection" and apply.
Solution 4
The question asks for how to deactivate the verification because of the unfixed IntelliJ bug causing false errors for the syntax "${dynamic.variable}" in dynamic pom.xml variables.
Instead, here is a workaround for the bug, so the false error notification disappears and the maven still accepts the variable and everyone is happy:
Change variable syntax in this order (no joke): 1. "${dynamic.variable}" 2. "{dynamic.variable}" 3. "{$dynamic.variable}"
IntelliJ will now accept it as correct and maven will also parse and accept the dynamic variable without problem. It is obviously an undocumented maven syntax which for some reason has been implemented as the correct and only syntax in IntelliJ IDE.
I hope this helps everyone, despite it not answering the actually asked question, but eliminates the reason for asking it instead.
Have fun :)
Related videos on Youtube
Dragan Bozanovic
Java Developer. Author of Keepboard - open source cross-platform clipboard manager.
Updated on September 15, 2022Comments
-
Dragan Bozanovic over 1 year
I'm using buildnumber-maven-plugin to get Mercurial changeset as project build number:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <phase>initialize</phase> <goals> <goal>hgchangeset</goal> </goals> </execution> </executions> </plugin>
Then I use
${changeSet}
property to setbuild.number
property in the samepom.xml
:<build.number>${changeSet}</build.number>
However, IntelliJ IDEA complains that it
Cannot resolve symbol 'changeSet'
:Also, the module root and the affected
pom.xml
files are underlined in red in the Project tool window.I tried all of the offered Alt+Enter options and Maven configurations in the Settings; nothing helped.
Everything builds and works fine, I just want to get rid of the annoying error displayed in the IDE. Any suggestion?
IDE and environment:
IntelliJ IDEA 2016.1.2 Build #IC-145.972, built on May 14, 2016 JRE: 1.8.0_65-b17 amd64 JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
-
Carlos Andrés García almost 8 yearstry this stackoverflow.com/a/26099823/1371064
-
Adam over 6 yearsSame issue using
git-commit-id-plugin
-
-
Anton Koscejev almost 8 yearsUpvoting those IntelliJ issues sounds like the best long-term solution. :)
-
Dragan Bozanovic almost 8 yearsThe workaround works, thanks. I can live with the dummy value being used in my local environment, because the build on other environments is done with CI tools outside of the IDE anyway.
-
Admin almost 8 yearsTurning off the Maven inspections works for most of them, but doesn't seem to affect the "Cannot resolve symbol" one. If it works for you, can you say what version of IDEA it works in, and any other related settings or inspections you might have changed?
-
Adam over 6 yearsGood work-around for 2017.2. My pom.xml is now ticked green upper-right corner, no red highlights. Would still be good if Jetbrains fixed the issue though.
-
Adam over 6 yearsSpoke too soon. The work-around works where I'm using these dynamic properties in plugin configuration, but it doesn't work in my super-pom where I am using the variables in the project.properties section.
-
Roeland Van Heddegem over 5 yearsFYI: IDEA-96358 should be fixed