Skip to content

Conversation

gastaldi
Copy link
Contributor

@gastaldi gastaldi commented Mar 21, 2024

@gastaldi
Copy link
Contributor Author

@qmonmert b21fb24 (#130) looks like it doesn't mess up the final content

@gastaldi
Copy link
Contributor Author

@qmonmert @murdos I believe I have fixed the issue you reported with this PR. Can any of you please give it a try and let me know?

@gastaldi gastaldi force-pushed the extra_line_break branch 2 times, most recently from 9d9308e to 54eb5fc Compare March 21, 2024 17:55
@gastaldi gastaldi changed the title Make sure no extra line breaks are introduced Remove leftover indentation text nodes in DOM when elements are removed Mar 21, 2024
@gastaldi gastaldi requested a review from qmonmert March 21, 2024 17:58
@qmonmert
Copy link
Contributor

can you publish a beta version to test in our project?

@murdos
Copy link
Contributor

murdos commented Mar 21, 2024

@qmonmert : I'll build a snapshot version locally and test it.

@murdos
Copy link
Contributor

murdos commented Mar 21, 2024

@gastaldi : it's a bit better, but there's still an extra line:

 <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <scope>import</scope>
        
      </dependency>
    </dependencies>
  </dependencyManagement>

@gastaldi
Copy link
Contributor Author

@murdos @qmonmert I added your test and a potential fix now, can you have another look, please?

@murdos
Copy link
Contributor

murdos commented Mar 22, 2024

@gastaldi : the issue mentioned above #130 (comment) is still present :/
I'll try to reproduce and provide a minimalist test case.

@murdos
Copy link
Contributor

murdos commented Mar 23, 2024

@gastaldi : the issue mentioned above #130 (comment) is still present :/ I'll try to reproduce and provide a minimalist test case.

@gastaldi : Here's the test modified to reproduce the issue:

    @Test
    void should_not_add_extra_line_break() throws Exception {
        Path pom = Paths.get(getClass().getResource("extra-line-pom.xml").toURI());
        Model model = Maven.readModel(pom);
        model.getDependencyManagement().getDependencies().remove(0);
        Dependency dep = new Dependency();
        dep.setGroupId("org.springframework.boot");
        dep.setArtifactId("spring-boot-dependencies");
        dep.setVersion("${spring-boot.version}");
        dep.setScope("import");
        dep.setType("pom");
        Dependency dep2 = new Dependency();
        dep2.setGroupId("org.springframework.boot");
        dep2.setArtifactId("spring-boot-dependencies");
        dep2.setVersion("${spring-boot.version}");
        dep2.setScope("import");
        model.getDependencyManagement().addDependency(dep2);
        StringWriter sw = new StringWriter();
        Maven.writeModel(model, sw);
        Approvals.verify(sw.toString());
    }

@gastaldi
Copy link
Contributor Author

@murdos thank you for the test case, I've pushed a potential fix again, can you give it a try?

@murdos
Copy link
Contributor

murdos commented Mar 23, 2024

@gastaldi : I just tried, and it's now fixed! Thanks :-)

@gastaldi gastaldi merged commit af89d8d into main Mar 23, 2024
@gastaldi gastaldi deleted the extra_line_break branch March 23, 2024 15:25
@gastaldi
Copy link
Contributor Author

@murdos @qmonmert thank you very much for reporting and providing the test case. 35 should be on its way to central now, enjoy!

@qmonmert
Copy link
Contributor

@gastaldi thanks to you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maven.writeModel breaks some tests since v31
3 participants