eric-milles commented on code in PR #114:
URL: https://github.com/apache/ant-ivy/pull/114#discussion_r2283144609
##########
src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java:
##########
@@ -103,53 +103,69 @@ public static void write(ModuleDescriptor md, File
output, PomWriterOptions opti
variables.setVariable("ivy.pom.license",
options.getLicenseHeader(), true);
}
if (options.isPrintIvyInfo()) {
- String header = "<!--\n" + " Apache Maven 2 POM generated by
Apache Ivy\n"
- + " " + Ivy.getIvyHomeURL() + "\n" + " Apache Ivy
version: "
- + Ivy.getIvyVersion() + " " + Ivy.getIvyDate() + "\n"
+ "-->";
+ String header
+ = "<!--\n" // TODO: replace \n with lineSeparator()
+ + " Apache Maven 2 POM generated by Apache Ivy\n"
+ + " " + Ivy.getIvyHomeURL() + "\n"
+ + " Apache Ivy version: " + Ivy.getIvyVersion() + " " +
Ivy.getIvyDate() + "\n"
+ + "-->";
variables.setVariable("ivy.pom.header", header, true);
}
setModuleVariables(md, variables, options);
+ boolean dependencyManagement = false;
boolean dependenciesPrinted = false;
+ boolean overridesPrinted = false;
int lastIndent = 0;
int indent = 0;
- String line = in.readLine();
- while (line != null) {
+ String line;
+ while ((line = in.readLine()) != null) {
line = IvyPatternHelper.substituteVariables(line, variables);
if (line.contains(SKIP_LINE)) {
// skip this line
- line = in.readLine();
continue;
}
- if (line.trim().isEmpty()) {
- // empty line
- out.println(line);
- line = in.readLine();
- continue;
- }
+ if (!line.trim().isEmpty()) {
+ lastIndent = indent;
+ indent = line.indexOf('<');
- lastIndent = indent;
- indent = line.indexOf('<');
+ if (line.contains("<dependencyManagement>")) {
+ dependencyManagement = true;
+ }
- if (!dependenciesPrinted && line.contains("</dependencies>")) {
- printDependencies(md, out, options, indent, false);
- dependenciesPrinted = true;
- }
+ if (line.contains("</dependencyManagement>")) {
+ dependencyManagement = false;
Review Comment:
Yes, I suppose that's possible. Was just handling likely scenarios first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]