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

Fails the build when running using Maven 3.9.0 #168

Closed
akurtakov opened this issue Feb 20, 2023 · 18 comments · Fixed by #173
Closed

Fails the build when running using Maven 3.9.0 #168

akurtakov opened this issue Feb 20, 2023 · 18 comments · Fixed by #173

Comments

@akurtakov
Copy link

In any build where Maven3.9.0 is used failure like the following is seen:

[WARNING] The POM for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[ERROR] Plugin org.codehaus.mojo:build-helper-maven-plugin:3.3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0: 1 problem was encountered while building the effective model
[ERROR] [FATAL] Non-parseable POM /home/akurtakov/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom: UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible (position: START_DOCUMENT seen <?xml version="1.0" encoding="ISO-8859-1"... @1:42)  @ line 1, column 42
[ERROR] -> [Help 1]
@slawekjaranowski
Copy link
Member

can you provide

  • output of mvn -e ... with stack trace
  • any minimal example project
  • or any other steps to reproduce

For me:

  • I can rebuild this project with ITs
  • I can execute: mvn build-helper:help

@akurtakov
Copy link
Author

I failed to reproduce with simple project but using the very complicated build of https://github.com/eclipse-platform/eclipse.platform.releng.aggregator and mvn clean verify -DskipTests=true -e I get:

[WARNING] The POM for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[ERROR] Plugin org.codehaus.mojo:build-helper-maven-plugin:3.3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0: 1 problem was encountered while building the effective model
[ERROR] [FATAL] Non-parseable POM /home/akurtakov/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom: UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible (position: START_DOCUMENT seen <?xml version="1.0" encoding="ISO-8859-1"... @1:42)  @ line 1, column 42
[ERROR] -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:build-helper-maven-plugin:3.3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:125)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:180)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:265)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:214)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate.calculateLifecycleMappings (DefaultLifecycleMappingDelegate.java:101)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings (DefaultLifecycleExecutionPlanCalculator.java:239)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:197)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:119)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:135)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:93)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:100)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.mojo:build-helper-maven-plugin:jar:3.3.0
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:291)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:169)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:286)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:104)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:180)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:265)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:214)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate.calculateLifecycleMappings (DefaultLifecycleMappingDelegate.java:101)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings (DefaultLifecycleExecutionPlanCalculator.java:239)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:197)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:119)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:135)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:93)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:100)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.model.building.ModelBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-parseable POM /home/akurtakov/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom: UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible (position: START_DOCUMENT seen <?xml version="1.0" encoding="ISO-8859-1"... @1:42)  @ line 1, column 42

    at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException (DefaultModelProblemCollector.java:176)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel (DefaultModelBuilder.java:586)
    at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:257)
    at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:243)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:278)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:169)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:286)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:104)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:180)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:265)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:214)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate.calculateLifecycleMappings (DefaultLifecycleMappingDelegate.java:101)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings (DefaultLifecycleExecutionPlanCalculator.java:239)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:197)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:119)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:135)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:93)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:100)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

@slawekjaranowski
Copy link
Member

Can you check something like:

download original files:

curl -O https://repo1.maven.org/maven2/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom
curl -O https://repo1.maven.org/maven2/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom.sha1

check sha1 sum:

$ cat build-helper-maven-plugin-3.3.0.pom.sha1 
2cdace188b5ca5d990904db151a2e07e8bf4176b

$ shasum -a 1 build-helper-maven-plugin-3.3.0.pom
2cdace188b5ca5d990904db151a2e07e8bf4176b  build-helper-maven-plugin-3.3.0.pom

next check in your local repo:

$ shasum -a 1 ~/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom
2cdace188b5ca5d990904db151a2e07e8bf4176b  /Users/slawomir.jaranowski/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom

show first bytes of pom:

$ hexdump -C ~/.m2/repository/org/codehaus/mojo/build-helper-maven-plugin/3.3.0/build-helper-maven-plugin-3.3.0.pom | head -n 3
00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 22 31  |<?xml version="1|
00000010  2e 30 22 20 65 6e 63 6f  64 69 6e 67 3d 22 49 53  |.0" encoding="IS|
00000020  4f 2d 38 38 35 39 2d 31  22 3f 3e 0a 3c 70 72 6f  |O-8859-1"?>.<pro|

as you see there is no UTF-8 BOM

@akurtakov
Copy link
Author

Checked all that and got exactly the same matching output as yours. As I fail to come up with small reproducer feel free to close this one and I'll have toopen new one if/when I manage to do so.

@slawekjaranowski
Copy link
Member

As we see referenced pom doesn't have a BOM marker ...
I suspect that other plugins use in build change something in the fly ...

@michael-o
Copy link
Member

@michael-o
Copy link
Member

I can't reproduce either...

@akurtakov
Copy link
Author

@michael-o So does it mean that something in my build end up using old plexus-util is the most likely cause of the issue and I should look at the plugins dependency trees to figure that ?

@michael-o
Copy link
Member

@michael-o So does it mean that something in my build end up using old plexus-util is the most likely cause of the issue and I should look at the plugins dependency trees to figure that ?

This is my current assumption, but not with full certainty. Wipe your local repo and check the plugin's class path. We have seen classes in other areas as well. Once in a while.

@belingueres
Copy link

I can reproduce it. I confirm this is a bug in the MXParser of the plexus-utils version shipped with Maven 3.9.0. I'll be working on a patch ASAP.

thomaskrause added a commit to hexatomic/hexatomic that referenced this issue Feb 28, 2023
Maven 3.9.0 has some issues with one of the dependencies: mojohaus/build-helper-maven-plugin#168

This is hopefully fixed im Maven 3.9.1
@akurtakov
Copy link
Author

@michael-o @slawekjaranowski Do you think you can find the time trying with m2e-core where ther issue happens and the build is not complicated from maven POV ? https://github.com/eclipse-m2e/m2e-core/actions/runs/4302035497/jobs/7500001979

@gnodet
Copy link
Contributor

gnodet commented Mar 1, 2023

The problem is fixed in takari/polyglot-maven#259 / eclipse-tycho/tycho#2176

@laeubi
Copy link

laeubi commented Apr 7, 2023

By the way, it would be great if the file encoding of the pom.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

could still be changed to the standard UTF-8 format, I don't really see any advantage of using non standard ISO-8859-1 (beside confusing users and tools ;-) )

I can reproduce it. I confirm this is a bug in the MXParser of the plexus-utils version shipped with Maven 3.9.0. I'll be working on a patch ASAP.

It would be great if at least the error message could be improved. Because this was not caused by a UTF-8 BOM, but because MXParser do some checking inf the used InputStream classes and extract the encoding from there, so this file defiantly has no UTF-8 BOM.

@michael-o
Copy link
Member

By the way, it would be great if the file encoding of the pom.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

could still be changed to the standard UTF-8 format, I don't really see any advantage of using non standard ISO-8859-1 (beside confusing users and tools ;-) )

I can reproduce it. I confirm this is a bug in the MXParser of the plexus-utils version shipped with Maven 3.9.0. I'll be working on a patch ASAP.

It would be great if at least the error message could be improved. Because this was not caused by a UTF-8 BOM, but because MXParser do some checking inf the used InputStream classes and extract the encoding from there, so this file defiantly has no UTF-8 BOM.

Nothing is wrong in using ISO-8859-1. It IS a standard from ISO. The parser we have is just faulty, no?

@laeubi
Copy link

laeubi commented Apr 7, 2023

Nothing is wrong in using ISO-8859-1. It IS a standard from ISO. The parser we have is just faulty, no?

Even though ISO-8859-1 is a standard, UTF-8 is the standard encoding of XML documents, so what is the advantage here to use a different one.

@michael-o
Copy link
Member

Nothing is wrong in using ISO-8859-1. It IS a standard from ISO. The parser we have is just faulty, no?

Even though ISO-8859-1 is a standard, UTF-8 is the standard encoding of XML documents, so what is the advantage here to use a different one.

Here none. Using ISO-8859-1 is just an ugly Windows habit I have seen over the years.

@laeubi
Copy link

laeubi commented Apr 7, 2023

Thats why I suggest to simply remove the marker for ISO-8859-1 on the pom so that new releases simply follow the standard xml encoding :-)

@gnodet
Copy link
Contributor

gnodet commented Apr 7, 2023

Thats why I suggest to simply remove the marker for ISO-8859-1 on the pom so that new releases simply follow the standard xml encoding :-)

#173

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.

6 participants