GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — Fix `analyze-exclusions` crashes if there is no `dependencyManagement` element by JackPGreen · Pull Request #1597 · apache/maven-dependency-plugin Conversation
Contributor
As reported in #1474, when executed on a project without a When executing maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java Lines 118 to 123 in a99bc57
Updated this mojo (and corresponding test) to suit. Fixes: #1474
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions… element As reported in apache#1474, when executed on a project without a `dependencyManagement` tag defined, an exception is thrown: ``` [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.10.0:analyze-exclusions (default-cli) on project reproducer: Execution default-cli of goal org.apache.maven.plugins:maven-dependency-plugin:3.10.0:analyze-exclusions failed: Cannot invoke "org.apache.maven.model.DependencyManagement.getDependencies()" because the return value of "org.apache.maven.project.MavenProject.getDependencyManagement()" is null -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.10.0:analyze-exclusions (default-cli) on project reproducer: Execution default-cli of goal org.apache.maven.plugins:maven-dependency-plugin:3.10.0:analyze-exclusions failed: Cannot invoke "org.apache.maven.model.DependencyManagement.getDependencies()" because the return value of "org.apache.maven.project.MavenProject.getDependencyManagement()" is null {...} Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.maven.model.DependencyManagement.getDependencies()" because the return value of "org.apache.maven.project.MavenProject.getDependencyManagement()" is null at org.apache.maven.plugins.dependency.exclusion.AnalyzeExclusionsMojo.execute (AnalyzeExclusionsMojo.java:106) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) 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:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:919) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:285) at org.apache.maven.cli.MavenCli.main (MavenCli.java:207) 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) ``` When executing `analyze-exclusions`, we simply assume `getDependencyManagement` returns non-`null`. Whereas in other mojos a more cautious approach is taken, e.g.: https://github.com/apache/maven-dependency-plugin/blob/a99bc570747b2623a4f3e5ca5a3dc98e379bd58b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java#L118-L123 Updated this mojo (and corresponding test) to suit. Fixes: apache#1474
elharo
requested changes
Uh oh!
There was an error while loading. Please reload this page.
elharo
requested changes
Uh oh!
There was an error while loading. Please reload this page. As requested in apache#1597 (comment)
elharo
reviewed
Uh oh!
There was an error while loading. Please reload this page.
elharo
approved these changes
cstamas
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page. AssigneesLabels
bug
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. [MDEP-968] analyze-exclusions crashes if there is no dependencyManagement elementUh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |