Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating invalid pom.xml is skipped silently #321

Closed
justinedelson opened this issue Nov 28, 2018 · 2 comments · Fixed by #399
Closed

Updating invalid pom.xml is skipped silently #321

justinedelson opened this issue Nov 28, 2018 · 2 comments · Fixed by #399

Comments

@justinedelson
Copy link

I ran into a situation today where a module's pom.xml file had a leading space, i.e. the first line was:

 <?xml version="1.0" encoding="UTF-8"?>

Maven's XML parser happily ignored this and built the project. However, when the versions-maven-plugin was used on the aggregator, the module was silently skipped and no debug information indicated the source of the problem (sanitized debug information is below) -- based on the debug information, both the aggregator and its two child modules (core and react-app) should have been updated, but only the aggregator and core was. I had to run a debugger to see the problem.

This is (I hope) a rare occurrence, but I do think it would be useful if something was output in this case.

Debug log:

[INFO] Searching for local aggregator root...
[DEBUG] Checking to see if /Users/jedelson/workspaces/projects/testbed is an aggregator parent
[DEBUG] Local aggregation root is /Users/jedelson/workspaces/projects/testbed/buggy-project
[INFO] Local aggregation root: /Users/jedelson/workspaces/projects/testbed/buggy-project
[DEBUG] Finding child modules...
[DEBUG] Child modules:
[DEBUG]   core
[DEBUG]   react-app
[DEBUG] Removing child modules which are missing...
[DEBUG] After removing missing
[DEBUG]   core
[DEBUG]   react-app
[DEBUG] Finding child modules...
[DEBUG] Child modules:
[DEBUG] None.
[DEBUG] Removing child modules which are missing...
[DEBUG] After removing missing
[DEBUG] None.
[DEBUG] Finding child modules...
[DEBUG] Child modules:
[DEBUG] None.
[DEBUG] Removing child modules which are missing...
[DEBUG] After removing missing
[DEBUG] None.
[INFO] Processing change of *:*:* -> 2018.11.0.test1
[DEBUG] Applying change com.testco:buggy-project: -> 2018.11.0.test1
[DEBUG] Processing root module as parent
[DEBUG] Looking for modules which use com.testco:buggy-project as their parent
[DEBUG] Module:
[DEBUG]     parent is com.testco:buggy-project:
[DEBUG]     will become com.testco:buggy-project:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project:2018.11.0.test1
[DEBUG] Module: core
[DEBUG]     parent is com.testco:buggy-project:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.core:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.core:2018.11.0.test1
[DEBUG] Module: react-app
[DEBUG]     parent is com.testco:buggy-project:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.react:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.react:2018.11.0.test1
[DEBUG] Processing core as a parent.
[DEBUG] Looking for modules which use com.testco:buggy-project.core as their parent
[DEBUG] Module:
[DEBUG]     parent is com.testco:buggy-project.core:
[DEBUG]     will become com.testco:buggy-project.core:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project:2018.11.0.test1
[DEBUG] Module: core
[DEBUG]     parent is com.testco:buggy-project.core:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.core:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.core:2018.11.0.test1
[DEBUG] Module: react-app
[DEBUG]     parent is com.testco:buggy-project.core:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.core:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.react:2018.11.0.test1
[DEBUG] Processing react-app as a parent.
[DEBUG] Looking for modules which use com.testco:buggy-project.react as their parent
[DEBUG] Module:
[DEBUG]     parent is com.testco:buggy-project.react:
[DEBUG]     will become com.testco:buggy-project.react:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project:2018.11.0.test1
[DEBUG] Module: core
[DEBUG]     parent is com.testco:buggy-project.react:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.react:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.core:2018.11.0.test1
[DEBUG] Module: react-app
[DEBUG]     parent is com.testco:buggy-project.react:0.0.1-SNAPSHOT
[DEBUG]     will become com.testco:buggy-project.react:2018.11.0.test1
[DEBUG]     module is com.testco:buggy-project.react:2018.11.0.test1
[INFO] Processing com.testco:buggy-project
[INFO]     Updating project com.testco:buggy-project
[INFO]         from version  to 2018.11.0.test1
[INFO]
[DEBUG] Skipping generation of backup file
[INFO] Processing com.testco:buggy-project.core
[INFO]     Updating parent com.testco:buggy-project
[INFO]         from version  to 2018.11.0.test1
[INFO]
[DEBUG] Skipping generation of backup file
justinedelson added a commit to justinedelson/versions-maven-plugin that referenced this issue Nov 28, 2018
* ModifiedPomXMLEventReader now takes a path and Log object
* If an error is encountered during parsing, a message is logged
@fmarot
Copy link

fmarot commented Jan 27, 2020

+1
I just ran into this weird issue where a colleague had introduced a leading space in the file, and the versions plugin silently ignored this file.
More than a warning in logs, I think the whole build should fail if parsing a pom is impossible.

@stefanseifert
Copy link
Contributor

i'm also of the opinion that a child POM with unparseable XML should not be skipped but fail the build.
PR #399 provides this including an integration tests that validated the failure.

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 a pull request may close this issue.

3 participants