Question

In my project's POM, I use maven-resources-plugin to set some properties from a file. However, Intellij flags these property references in the POM with the error "cannot resolve symbol", presumably because it cannot see them being defined anywhere. Is there a way to suppress this error?

Was it helpful?

Solution 3

Yes, you can open Settings (spanner icon), go to Project Settings -> Inspections and then disable the inspection Maven -> Maven Model Inspection.

Alternatively, you might like to try defining "blank" values for the properties, and see if the plugin successfully overwrites them.

<properties>
     <myproperty></myproperty>
</properties>

Good luck!

OTHER TIPS

Warning: The solution to define the property blank as vikingsteve mentioned is very dangerous because in Maven 3 properties which are declared in pom.xml could not be changed by other plugins.

So if you have one plugin which sets a property and another plugin which reads the value of the property it will always get an empty string if you initialize it in the pom.xml.

In fact you can't define it in the pom.xml but i have no idea what i can do to eliminate the IntelliJ IDEA warning. For now i have to disable the "Maven model inspection". :-(

The best way I see to solve the issue is to use the following comment:

<!-- suppress UnresolvedMavenProperty -->

Empty properties are not overwritten or may be a risky operation as @Josef mentioned.

Error “cannot resolve symbol” can occur if you open a directory maven project, but intellij project has not yet been created. Why does the "Maven model inspection" there is such a relationship - is not clear, but it helped me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top