mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-176281 - fix of maven modules imports in cases when pom.xml file located in folder named *.xml
This commit is contained in:
@@ -224,13 +224,13 @@ public class MavenProject {
|
||||
private Map<String, String> collectModulePathsAndNames(MavenModel mavenModel, String baseDir) {
|
||||
String basePath = baseDir + "/";
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, String> each : collectModulesRelativePathsAndNames(mavenModel).entrySet()) {
|
||||
for (Map.Entry<String, String> each : collectModulesRelativePathsAndNames(mavenModel, basePath).entrySet()) {
|
||||
result.put(new Path(basePath + each.getKey()).getPath(), each.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, String> collectModulesRelativePathsAndNames(MavenModel mavenModel) {
|
||||
private Map<String, String> collectModulesRelativePathsAndNames(MavenModel mavenModel, String basePath) {
|
||||
String extension = StringUtil.notNullize(myFile.getExtension());
|
||||
LinkedHashMap<String, String> result = new LinkedHashMap<>();
|
||||
for (String name : mavenModel.getModules()) {
|
||||
@@ -246,6 +246,12 @@ public class MavenProject {
|
||||
if (!name.endsWith("/")) name += "/";
|
||||
name += MavenConstants.POM_EXTENSION + '.' + extension;
|
||||
}
|
||||
else {
|
||||
String systemDependentName = FileUtil.toSystemDependentName(basePath + name);
|
||||
if (new File(systemDependentName).isDirectory()) {
|
||||
name += "/" + MavenConstants.POM_XML;
|
||||
}
|
||||
}
|
||||
|
||||
result.put(name, originalName);
|
||||
}
|
||||
|
||||
+22
@@ -42,6 +42,28 @@ public class CustomPomFileNameTest extends MavenDomTestCase {
|
||||
assertModules("project", "m1");
|
||||
}
|
||||
|
||||
public void testFolderNameWithXmlExtension() throws Exception {
|
||||
createProjectSubFile("customName.xml/pom.xml", createPomXml(
|
||||
"<artifactId>m1</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<parent>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>project</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
"</parent>"));
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<modules>" +
|
||||
" <module>customName.xml</module>" +
|
||||
"</modules>");
|
||||
|
||||
assertModules("project", "m1");
|
||||
}
|
||||
|
||||
public void testModuleCompletion() throws Exception {
|
||||
createProjectSubFile("m1/customPom.xml", createPomXml(
|
||||
"<artifactId>m1</artifactId>" +
|
||||
|
||||
Reference in New Issue
Block a user