[maven][IDEA-371747] import maven compiler args with weird names

GitOrigin-RevId: b56453b894746b7a8500d01c1d4cdfe7c4d34d0d
This commit is contained in:
Alexander Bubenchikov
2025-04-28 14:29:59 +02:00
committed by intellij-monorepo-bot
parent c11715a6b9
commit c2de41bc55
2 changed files with 38 additions and 2 deletions

View File

@@ -311,12 +311,16 @@ class MavenCompilerConfigurator : MavenApplicableConfigurator(GROUP_ID, ARTIFACT
}
}
}
MavenJDOMUtil.findChildrenValuesByPath(element, "compilerArgs", "arg").forEach {
val text = getResolvedText(it)
element.getChild("compilerArgs")?.children?.forEach {
val text = getResolvedText(it.text)
if (text != null && !hasUnresolvedProperty(text)) {
result.add(text)
}
}
MavenJDOMUtil.findChildrenValuesByPath(element, "compilerArgs", "arg").forEach {
}
element.getChild("compilerArgument")?.textTrim?.let {
val text = getResolvedText(it)
if (text != null && !hasUnresolvedProperty(text)) {

View File

@@ -1214,4 +1214,36 @@ class MavenCompilerImportingTest : MavenMultiVersionImportingTestCase() {
"--add-exports", "java.base/sun.reflect.annotation=ALL-UNNAMED", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED")
}
@Test
@TestFor(issues = ["IDEA-371747"])
fun testCompilerArgumentsWithWeirdNames() = runBlocking {
importProjectAsync("""
<groupId>test</groupId>
<artifactId>project</artifactId>
<version>1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<release>17</release>
<encoding>UTF-8</encoding>
<source>17</source>
<compilerArgs>
<myWeirdName>-blablabla</myWeirdName>
<anotherWeirdname>-qwerty</anotherWeirdname>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build> """.trimIndent())
assertModules("project")
assertOrderedElementsAreEqual(ideCompilerConfiguration.getAdditionalOptions(getModule("project")),
"-blablabla", "-qwerty")
}
}