[
https://issues.apache.org/jira/browse/MENFORCER-319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16685449#comment-16685449
]
ASF GitHub Bot commented on MENFORCER-319:
------------------------------------------
wilx opened a new pull request #45: [MENFORCER-319] Handle UTF-8 BOM when
parsing pom.xml files
URL: https://github.com/apache/maven-enforcer/pull/45
Handle parsing of pom.xml in BanDuplicatePomDependencyVersions.java
similarly to how actual Maven model parser handles it to fix handling
of pom.xml files with UTF-8 BOM.
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Make sure there is a [JIRA
issue](https://issues.apache.org/jira/browse/MENFORCER) filed
for the change (usually before you start working on it). Trivial
changes like typos do not
require a JIRA issue. Your pull request should address just this
issue, without
pulling in other changes.
[MENFORCER-319](https://issues.apache.org/jira/browse/MENFORCER-319)
- [ ] Each commit in the pull request should have a meaningful subject line
and body.
- [ ] Format the pull request title like `[MENFORCER-XXX] - Fixes bug in
ApproximateQuantiles`,
where you replace `MENFORCER-XXX` with the appropriate JIRA issue.
Best practice
is to use the JIRA issue title in the pull request title and in the
first line of the
commit message.
- [ ] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [ ] Run `mvn clean verify` to make sure basic checks pass. A more
thorough check will
be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> UTF-8 BOM in pom.xml breaks banDuplicatePomDependencyVersions rule
> ------------------------------------------------------------------
>
> Key: MENFORCER-319
> URL: https://issues.apache.org/jira/browse/MENFORCER-319
> Project: Maven Enforcer Plugin
> Issue Type: Bug
> Components: Standard Rules
> Affects Versions: 3.0.0-M2
> Reporter: Václav Haisman
> Priority: Major
> Attachments:
> Handle_parsing_of_pom_xml_in_BanDuplicatePomDependencyVersions_java_similarly_to_how_actua.patch,
> pom.xml
>
>
> Having UTF-8 BOM at the beginning of {{pom.xml}} causes the
> banDuplicatePomDependencyVersions rule to fail to parse the file with the
> following exception being shown by {{-X}} output:
> {noformat}
> [DEBUG] Adding failure due to exception
> org.apache.maven.enforcer.rule.api.EnforcerRuleException: Unable to retrieve
> the MavenProject:
> at
> org.apache.maven.plugins.enforcer.BanDuplicatePomDependencyVersions.execute
> (BanDuplicatePomDependencyVersions.java:87)
> at org.apache.maven.plugins.enforcer.EnforceMojo.execute
> (EnforceMojo.java:194)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> (DefaultBuildPluginManager.java:137)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:208)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:154)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:146)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:117)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:81)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> (SingleThreadedBuilder.java:56)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> (LifecycleStarter.java:128)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
> at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
> at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
> at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (Unknown
> Source)
> at java.lang.reflect.Method.invoke (Unknown Source)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:289)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:229)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:415)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:356)
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: only
> whitespace content allowed before start tag and not \uef (position:
> START_DOCUMENT seen \uef... @1:1)
> at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog
> (MXParser.java:1862)
> at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl
> (MXParser.java:1698)
> at org.codehaus.plexus.util.xml.pull.MXParser.next (MXParser.java:1317)
> at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read
> (MavenXpp3Reader.java:3856)
> at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read
> (MavenXpp3Reader.java:595)
> at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read
> (MavenXpp3Reader.java:609)
> at
> org.apache.maven.plugins.enforcer.BanDuplicatePomDependencyVersions.execute
> (BanDuplicatePomDependencyVersions.java:75)
> at org.apache.maven.plugins.enforcer.EnforceMojo.execute
> (EnforceMojo.java:194)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> (DefaultBuildPluginManager.java:137)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:208)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:154)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:146)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:117)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:81)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> (SingleThreadedBuilder.java:56)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> (LifecycleStarter.java:128)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
> at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
> at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
> at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (Unknown
> Source)
> at java.lang.reflect.Method.invoke (Unknown Source)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:289)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:229)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:415)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:356)
> [WARNING] Rule 0:
> org.apache.maven.plugins.enforcer.BanDuplicatePomDependencyVersions failed
> with message:
> Unable to retrieve the MavenProject:
> {noformat}
> See attached {{pom.xml}} for minimal example.
> Attached patch changes the parsing to be compatible with UTF-8 BOM and fixes
> the issue for me.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)