PsiElement () { boolean hasPrefix = false; String unprefixed = myText; if (myText.startsWith("pom.")) { unprefixed = myText.substring("pom.".length()); hasPrefix = true; } else if (myText.startsWith("project.")) { unprefixed = myText.substring("project.".length()); hasPrefix = true; } MavenProject mavenProject = myMavenProject; while (unprefixed.startsWith("parent.")) { if (unprefixed.equals("parent.groupId") || unprefixed.equals("parent.artifactId") || unprefixed.equals("parent.version") || unprefixed.equals("parent.relativePath")) { break; } MavenId parentId = mavenProject.getParentId(); if (parentId == null) return null; mavenProject = myProjectsManager.findProject(parentId); if (mavenProject == null) return null; unprefixed = unprefixed.substring("parent.".length()); } if (unprefixed.equals("basedir") || (hasPrefix && mavenProject == myMavenProject && unprefixed.equals("baseUri"))) { return getBaseDir(mavenProject); } if (myText.equals(TIMESTAMP_PROP)) { return myElement; } if (myText.equals(MULTIPROJECT_DIR_PROP)) { MavenProject rootProject = myProjectsManager.findRootProject(myMavenProject); if(rootProject == null) return null; return getBaseDir(rootProject); } if (hasPrefix) { MavenDomProjectModel domProjectModel = MavenDomUtil.getMavenDomProjectModel(myProject, mavenProject.getFile()); if (domProjectModel != null) { PsiElement res = resolveModelProperty(domProjectModel, unprefixed, new HashSet<>()); if (res != null) { return res; } } } if (mavenProject.getMavenConfig().containsKey(myText)) { return resolveConfigFileProperty(MavenConstants.MAVEN_CONFIG_RELATIVE_PATH, mavenProject.getMavenConfig().get(myText)); } if (mavenProject.getJvmConfig().containsKey(myText)) { return resolveConfigFileProperty(MavenConstants.JVM_CONFIG_RELATIVE_PATH, mavenProject.getJvmConfig().get(myText)); } MavenRunnerSettings runnerSettings = MavenRunner.getInstance(myProject).getSettings(); if (runnerSettings.getMavenProperties().containsKey(myText) || runnerSettings.getVmOptions().contains("-D" + myText + '=')) { return myElement; } if (MavenUtil.getPropertiesFromMavenOpts().containsKey(myText)) { return myElement; } MavenDomProfile profile = DomUtil.findDomElement(myElement, MavenDomProfile.class); if (profile != null) { PsiElement result = MavenDomProjectProcessorUtils.findProperty(profile.getProperties(), myText); if (result != null) return result; } MavenDomConfiguration pluginCfg = DomUtil.findDomElement(myElement, MavenDomConfiguration.class); if (pluginCfg != null) { boolean notFound = MavenPluginDescriptor.processDescriptors(descriptor -> { if (descriptor.properties != null) { for (MavenPluginDescriptor.ModelProperty property : descriptor.properties) { if (property.insideConfigurationOnly && property.name.equals(myText)) { return false; } } } return true; }, pluginCfg); if (!notFound) { return myElement; } } if (myProjectDom != null) { PsiElement result = MavenDomProjectProcessorUtils.searchProperty(myText, myProjectDom, myProject); if (result != null) return result; } if ("java.home".equals(myText)) { PsiElement element = resolveToCustomSystemProperty("java.home", MavenUtil.getModuleJreHome(myProjectsManager, mavenProject)); if (element != null) { return element; } } if ("java.version".equals(myText)) { PsiElement element = resolveToCustomSystemProperty("java.version", MavenUtil.getModuleJavaVersion(myProjectsManager, mavenProject)); if (element != null) { return element; } } MavenPropertiesVirtualFileSystem mavenPropertiesVirtualFileSystem = MavenPropertiesVirtualFileSystem.getInstance(); IProperty property = mavenPropertiesVirtualFileSystem.findSystemProperty(myProject, myText); if (property != null) return property.getPsiElement(); if (myText.startsWith("env.")) { property = mavenPropertiesVirtualFileSystem.findEnvProperty(myProject, myText.substring("env.".length())); if (property != null) return property.getPsiElement(); } String textWithEnv = "env." + myText; property = mavenPropertiesVirtualFileSystem.findSystemProperty(myProject, textWithEnv); if (property != null) return property.getPsiElement(); property = mavenPropertiesVirtualFileSystem.findEnvProperty(myProject, textWithEnv); if (property != null) return property.getPsiElement(); if (!hasPrefix) { MavenDomProjectModel domProjectModel = MavenDomUtil.getMavenDomProjectModel(myProject, mavenProject.getFile()); if (domProjectModel != null) { PsiElement res = resolveModelProperty(domProjectModel, unprefixed, new HashSet<>()); if (res != null) { return res; } } } if (mavenProject.getProperties().containsKey(myText)) { return myElement; } if (myText.startsWith("settings.")) { return resolveSettingsModelProperty(); } return null; }