[ 
https://issues.apache.org/jira/browse/MNG-8349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17892373#comment-17892373
 ] 

Michael Osipov edited comment on MNG-8349 at 10/24/24 7:27 AM:
---------------------------------------------------------------

I am genuinely confused since I expected this to be a pure string comparison.


was (Author: michael-o):
I am genuinely confused since I expected this to be a pure string comparsion.

> NumberFormatException during model building
> -------------------------------------------
>
>                 Key: MNG-8349
>                 URL: https://issues.apache.org/jira/browse/MNG-8349
>             Project: Maven
>          Issue Type: Bug
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.0.0-beta-6
>
>
> {code}
> <project>
>   <modelVersion>4..0.0</modelVersion>
>   <groupId>org.test</groupId>
>   <artifactId>foo</artifactId>
>   <version>1.0-SNAPSHOT</version>
>   <packaging>jar</packaging>
> </project>
> {code}
> The above pom.xml leads to the following error:
> {code}
> [INFO] Scanning for projects...
> [ERROR] Internal error: java.lang.NumberFormatException: For input string: "" 
> -> [Help 1]
> org.apache.maven.InternalErrorException: Internal error: 
> java.lang.NumberFormatException: For input string: ""
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:157)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.doExecute(DefaultMavenInvoker.java:496)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:113)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:80)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:235)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:210)
>     at org.apache.maven.cling.ClingSupport.run(ClingSupport.java:68)
>     at org.apache.maven.cling.MavenCling.main(MavenCling.java:51)
>     at 
> jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>     at java.lang.reflect.Method.invoke(Method.java:580)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
> Caused by: java.lang.NumberFormatException: For input string: ""
>     at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
>     at java.lang.Long.parseLong(Long.java:719)
>     at java.lang.Long.valueOf(Long.java:1157)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelValidator.compareModelVersions(DefaultModelValidator.java:1967)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelValidator.validateModelVersion(DefaultModelValidator.java:1911)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelValidator.validateFileModel(DefaultModelValidator.java:367)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.doReadFileModel(DefaultModelBuilder.java:1434)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelCache$CachingSupplier.get(DefaultModelCache.java:178)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelCache.computeIfAbsent(DefaultModelCache.java:65)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelCache.computeIfAbsent(DefaultModelCache.java:56)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.cache(DefaultModelBuilder.java:1734)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.readFileModel(DefaultModelBuilder.java:1239)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.loadFilePom(DefaultModelBuilder.java:733)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.loadFromRoot(DefaultModelBuilder.java:711)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$DefaultModelBuilderSession.buildBuildPom(DefaultModelBuilder.java:658)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$1.build(DefaultModelBuilder.java:226)
>     at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.build(DefaultProjectBuilder.java:497)
>     at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.lambda$doBuild$5(DefaultProjectBuilder.java:474)
>     at 
> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
>     at java.util.Collections$2.tryAdvance(Collections.java:5073)
>     at java.util.Collections$2.forEachRemaining(Collections.java:5081)
>     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
>     at 
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
>     at 
> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
>     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>     at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
>     at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.doBuild(DefaultProjectBuilder.java:476)
>     at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.build(DefaultProjectBuilder.java:450)
>     at 
> org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:184)
>     at 
> org.apache.maven.project.collector.DefaultProjectsSelector.selectProjects(DefaultProjectsSelector.java:61)
>     at 
> org.apache.maven.project.collector.RequestPomCollectionStrategy.collectProjects(RequestPomCollectionStrategy.java:49)
>     at 
> org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:364)
>     at 
> org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:100)
>     at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:629)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:250)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.doExecute(DefaultMavenInvoker.java:496)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:113)
>     at 
> org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:80)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:235)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:210)
>     at org.apache.maven.cling.ClingSupport.run(ClingSupport.java:68)
>     at org.apache.maven.cling.MavenCling.main(MavenCling.java:51)
>     at 
> jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>     at java.lang.reflect.Method.invoke(Method.java:580)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
> [ERROR] 
> [ERROR] To see the full stack trace of the errors, re-run Maven with the '-e' 
> switch
> [ERROR] Re-run Maven using the '-X' switch to enable verbose output
> [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/InternalErrorException
> {code}
> The error is somehow expected given the typo in the {{modelVersion}}, but a 
> more friendly exception would be welcomed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to