diff --git a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
index b0c6bc8d..430f4dbd 100644
--- a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
+++ b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
@@ -253,6 +253,100 @@ public class IvyMakePomTest {
assertEquals(String.join(System.lineSeparator(), expect), readFileToString(pomFile, "UTF-8"));
}
+ /**
+ * Test case for IVY-1667.
+ */
+ @Test
+ public void testMakePomWithTemplate1667_2() throws Exception {
+ File ivyFile = workdir.newFile("ivy.xml");
+ writeLines(ivyFile, "UTF-8", Arrays.asList(
+ "",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ ""
+ ));
+
+ File pomFile = workdir.newFile("ivy.pom");
+
+ File templateFile = workdir.newFile("the.pom");
+ writeLines(templateFile, "UTF-8", Arrays.asList(
+ "",
+ " ${ivy.pom.groupId}",
+ " ${ivy.pom.artifactId}",
+ " ${ivy.pom.version}",
+ " ",
+ " ",
+ " ",
+ " org.aspectj",
+ " aspectjrt",
+ " 1.9.24",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " org.springframework",
+ " spring-aop",
+ " 6.2.9",
+ " compile",
+ " ",
+ " ",
+ ""
+ ));
+
+ IvyMakePom task = new IvyMakePom();
+ task.setIvyFile(ivyFile);
+ task.setPomFile(pomFile);
+ task.setPrintIvyInfo(false);
+ task.setProject(project);
+ task.setTemplateFile(templateFile);
+
+ IvyMakePom.Mapping mapping = task.createMapping();
+ mapping.setConf("default");
+ mapping.setScope("compile");
+
+ task.execute();
+
+ String[] expect = {
+ "",
+ " org",
+ " name",
+ " 1.0.0-SNAPSHOT",
+ " ",
+ " ",
+ " ",
+ " org.aspectj",
+ " aspectjrt",
+ " 1.9.24",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " org.springframework",
+ " spring-aop",
+ " 6.2.9",
+ " compile",
+ " ",
+ " ",
+ " org.springframework",
+ " spring-core",
+ " 6.2.9",
+ " compile",
+ " ",
+ " ",
+ "",
+ ""
+ };
+
+ assertEquals(String.join(System.lineSeparator(), expect), readFileToString(pomFile, "UTF-8"));
+ }
+
//--------------------------------------------------------------------------
private static final class PomDependency {