You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2022/02/19 21:06:00 UTC

[jira] [Comment Edited] (MNG-7409) Improve exception message for VersionResolutionException thrown from o.a.m.repository.internal.DefaultVersionResolver

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

Michael Osipov edited comment on MNG-7409 at 2/19/22, 9:05 PM:
---------------------------------------------------------------

I agree with you [~michael-o] that copying (an) exception message(s) seems like a strange approach. It's similar to the construct we saw in the [{{ProjectBuildingException}}|https://github.com/apache/maven/commit/0be5e406d78062b56b32644fefce2642f5eab650] that we've recently removed.

I'd prefer dedicated Exceptions for the "predictable" error scenarios (e.g. "local repo didn't have anything and remote lookup was not tried [etc.]"). It would mean we could keep those Exception(s) in the {{VersionResult}} and only print the details when needed (i.e., in the CLI). WDYT?


was (Author: mthmulders):
I agree with you [~michael-o] that copying (an) exception message(s) seems like a strange approach. It's similar to the construct we saw in the [{{ProjectBuildingException}}|https://github.com/apache/maven/commit/0be5e406d78062b56b32644fefce2642f5eab650] that we've recently removed.

I'd prefer dedicated Exceptions for the "predictable" error scenario's (e.g. "local repo didn't have anything and remote lookup was not tried [etc.]"). It would mean we could keep those Exception(s) in the {{VersionResult}} and only print the details when needed (i.e., in the CLI). WDYT?

> Improve exception message for VersionResolutionException thrown from o.a.m.repository.internal.DefaultVersionResolver
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-7409
>                 URL: https://issues.apache.org/jira/browse/MNG-7409
>             Project: Maven
>          Issue Type: Improvement
>          Components: Artifacts and Repositories
>    Affects Versions: 3.8.4
>            Reporter: Konrad Windszus
>            Priority: Minor
>
> I have seen the following exception message with Maven 3.8.4
> {code}
>  [DEBUG] Skipped remote request for com.adobe.aem:aemanalyser-maven-plugin/maven-metadata.xml locally installed metadata up-to-date
> ....
> [ERROR]
> Caused by: org.eclipse.aether.resolution.VersionResolutionException: Failed to resolve version for com.adobe.aem:aemanalyser-maven-plugin:jar:RELEASE
>     at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion (DefaultVersionResolver.java:276)
>     at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveVersion (DefaultRepositorySystem.java:240)
>     at com.adobe.aem.analyser.mojos.VersionUtil.getLatestVersion (VersionUtil.java:232)
>     at com.adobe.aem.analyser.mojos.VersionUtil.checkPluginVersion (VersionUtil.java:253)
>     at com.adobe.aem.analyser.mojos.AemAnalyseMojo.execute (AemAnalyseMojo.java:243)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
>     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:972)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
>     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke (Method.java:566)
>     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)
> {code}
> (this was triggered in https://github.com/adobe/aemanalyser-maven-plugin/issues/138).
> The real cause is not visible in the stack trace as it seems that the {{VersionResult}} being passed to the constructor of {{VersionResolutionException}} in https://github.com/apache/maven/blob/6ca13af230e9a7c6dcb0bf629d9a2676d8f833ed/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java#L242 does not contain enough information.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)