intellij flags properties set by maven-resources-plugin as "cannot resolve symbol" - maven

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?

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.

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!

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.

Related

maven soupUI plugin properties file

Can somebody knows how to add property file example. file.properties to global settings in maven
soapui-maven-plugin. I tried so many option but nothing works.
Thanks

Gradle could not resolve org.springframework.vault:spring-vault-core

I have a project that adopts Spring Vault to fetch credential. Dependencies of the project are as following and build.gradle file is generated automatically afterwards.
When I build the project I got the error
Could not resolve
org.springframework.vault:spring-vault-core:2.2.2.RELEASE.
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I have checked the libraries by going to the Project Structures and got the weird thing
The weird thing I mean here is about the path of the jar file. It should be something like
%GRADLE_HOME%\caches\modules-2\files-2.1\org.springframework.cloud\spring-cloud-vault-config\2.2.3.RELEASE\5fd5a06deb01db77eb3e9b8e723ccc1e0790c420
How can I fix this issue in IntelliJ?
When you get an error about could not resolve dependencies in gradle, then there are several things you need to check.
Proxy settings (should be inside gradle.properties)
Permission for creating directories (particularly in %GRADLE_HOME%\caches\modules-2\files-2.1)
For the problem of proxy setting, simply set values for the following fields inside gradle.properties
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.nonProxyHosts=
systemProp.https.proxyHost=
systemProp.https.proxyPort=
systemProp.https.nonProxyHosts=
For the problem of permission, try creating directories with the name of dependencies cannot be resolved, for example, org.springframework.vault at %GRADLE_HOME%\caches\modules-2\files-2.1. If you got permission denied or simply cannot create, then please contact your IT support!

How to disable specific warning during Maven execution?

Due to the configuration I'm using, I get lots of these:
[WARNING] 'dependencies.dependency.systemPath' for local-deps:[...] should not point at files within the project directory, ${basedir}/[...] will be unresolvable by dependent projects [...]
Since this is how the application is currently setup, I can't fix them; but they clutter the console, so is there a way to disable them? mvn --quiet is not an option because it removes too many messages.
See the Maven 3.1.x logging documentation. You can configure the log level by editing the ${M2_HOME}/conf/logging/simplelogger.properties file. First set the value of org.slf4j.simpleLogger.showLogName to true and you will see the logname that prints your unwanted message. After that add the line org.slf4j.simpleLogger.log.a.b.c=error where a.b.c is the logname.

Tycho missing plugin when building an update site

When I build my project by tycho-maven-plugin, I encounter the following message:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: foo-updatesite raw:0.2.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):0.2.0-SNAPSHOT
[ERROR] Missing requirement for filter properties ~= $0: foo-feature.feature.group 0.2.0.qualifier requires 'foo-plugin 0.0.0' but it could not be found
[ERROR] Cannot satisfy dependency: foo-updatesite raw:0.2.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):0.2.0-SNAPSHOT depends on: foo-feature.feature.group [0.2.0,0.2.1)
This error occurs when building an update site. Plugin and feature are build normally. I build the update site from PDE without issues.
The project structure is common: there is a parent project with pom packaging and three modules: plugin, feature and updatesite. Of course, I invoke mvn clean package from the parent project.
What can be the reason for this error? How can I debug it?
UPD: I tried many things: removed "grandparent" pom, removed SNAPSHOT/qualifier, played with configuration. However, I found the solution: I switched to tycho 0.19 instead of 0.21. So I suppose there is a bug in tycho 0.21.
The error message
Missing requirement for filter properties ~= $0
indicates that you have defined an environment filter when you include the plugin foo-plugin in the feature.xml. However this does not explain the dependency resolution error you are seeing. The only way I can reproduce the error message is by adding an Eclipse-PlatformFilter header in the manifest of the plugin using a value which doesn't match environments configuration in the POM.
I had the same error message:
Missing requirement for filter properties ~= $0: foo-feature.feature.group 0.2.0.qualifier requires 'foo-plugin 0.0.0' but it could not be found
For some reason this error (also) means, that foo-plugin is present... twice.
So in your case, open the "Content" tab of the "Target Editor" and make sure that foo-plugin is not present in two distinct versions. I common way this could happen is if two features contain the same bundle.

tycho-p2-repository-plugin fails with "No content specified for p2 repository"

I am trying to build a p2 repository using Tycho and the tycho-p2-repository-plugin in an eclipse-repository packaging type. When I run the build, it is giving me the following exception:
Failed to execute goal org.eclipse.tycho:tycho-p2-repository-plugin:0.13.0:assemble-repository (default-assemble-repository) on project com.mycompany: No content specified for p2 repository
Can someone point me to the cause of this problem?
You need either of the following files in the root of the eclipse-repository project:
A category.xml files with at least one feature referenced in it
A *.product file
These files define what should be included in the p2 repository, so if there is none of these, the p2 repository would be empty. This is probably not what you wanted, so Tycho fails the build. (Admittedly, the error message could be more helpful...)
I had this problem too, unfortunately it was one of many problems and I do not remember which thing I did to fix it.
Make sure you are using 0.14.1 of tycho.
My working version is a very empty pom.xml, much like Packaging Types
I have not needed to configure the eclipse-repository via tycho-p2-repository-plugin.
Do you have a valid target definition defined in your reactor build somewhere?
Is your *.product file valid? The product file needs to be in the same directory as your eclipse-repository pom, I think it gets found via black magic.
Also make sure your product feature is separate from your eclipse-repository.
under PDE builds you could have the *.product file and the with the feature that is the root for your product.

Resources