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

org.codehaus.mojo:versions-maven-plugin:2.16.0:display-dependency-updates failed: Cannot invoke "Object.toString()" because "otherVersion" is null #973

Closed
freedom1b2830 opened this issue Jun 9, 2023 · 7 comments · Fixed by #974
Labels
Milestone

Comments

@freedom1b2830
Copy link

freedom1b2830 commented Jun 9, 2023

The project for which the plugin was called: https://github.com/publicLibs/RollingMavenHeader/commit/0a93dbce4c6657f816362971654d862d9798d510

command

mvn versions:display-dependency-updates -X > FULL_ERROR_X.txt

FULL_ERROR_X.txt

@slawekjaranowski
Copy link
Member

It can be connected with: #951 and https://issues.apache.org/jira/browse/MNG-7780

@andrzejj0
Copy link
Contributor

I'll check.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Jun 9, 2023

So this is about a versionless dependency of the spotbugs plugin:

<dependency>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs</artifactId>
</dependency>

Anyway, I see that something's not right even in 2.14.2 since we're trying to retrieve updates for com.github.spotbugs:spotbugs:jar:[,0]... which will be satisfied by any possible version. But I think that is a separate issue which is probably present in more places. To be investigated.

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 9, 2023
@slawekjaranowski slawekjaranowski added this to the next-release milestone Jun 23, 2023
@slawekjaranowski
Copy link
Member

slawekjaranowski commented Jun 23, 2023

@freedom1b2830 can you prepare simple project with one plugin and try also to execute plugin with such configuration ... for me it will not working

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 23, 2023
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Jun 23, 2023
@freedom1b2830
Copy link
Author

@freedom1b2830 can you prepare simple project with one plugin and try also to execute plugin with such configuration ... for me it will not working

@slawekjaranowski

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>issue973</groupId>
	<artifactId>issue973</artifactId>
	<version>issue973</version>
	<packaging>pom</packaging>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.github.spotbugs</groupId>
				<artifactId>spotbugs</artifactId>
				<version>4.7.3</version>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>com.github.spotbugs</groupId>
					<artifactId>spotbugs-maven-plugin</artifactId>
					<version>4.7.3.4</version>
					<dependencies>
						<dependency>
							<groupId>com.github.spotbugs</groupId>
							<artifactId>spotbugs</artifactId>
							<!-- NPE -->
						</dependency>
					</dependencies>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>

@slawekjaranowski
Copy link
Member

What result will be if you execute for such project:

mvn spotbugs:check

@freedom1b2830
Copy link
Author

freedom1b2830 commented Jun 24, 2023

Error if given pom.xml is called

(If I call spotbugs:check on a project that is a child of this pom.xml, then the check succeeds)

proj1 this pom call spotbugs:check ERROR
proj2 ( proj1) call spotbugs:check OK

The problem is initially with maven versions and does not apply to the call to spotbugs:check (the version to call is determined successfully from dependencyManagement)

I hope the fix is successful (#974)

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< issue973:issue973 >--------------------------
[INFO] Building issue973 issue973
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] >>> spotbugs-maven-plugin:4.7.3.4:check (default-cli) > :spotbugs @ issue973 >>>
[INFO] 
[INFO] --- spotbugs-maven-plugin:4.7.3.4:spotbugs (spotbugs) @ issue973 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.909 s
[INFO] Finished at: 2023-06-24T22:03:26Z
[INFO] ------------------------------------------------------------------------
[ERROR] version can neither be null, empty nor blank
[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 full debug logging
java.lang.IllegalArgumentException: version can neither be null, empty nor blank
    at org.apache.commons.lang3.Validate.notBlank (Validate.java:441)
    at org.apache.maven.artifact.ArtifactUtils.notBlank (ArtifactUtils.java:107)
    at org.apache.maven.artifact.ArtifactUtils.key (ArtifactUtils.java:97)
    at org.apache.maven.ReactorReader.findArtifact (ReactorReader.java:101)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:312)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:235)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:212)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:240)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:171)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.resolveCachedArtifactDescriptor (DefaultDependencyCollector.java:541)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.getArtifactDescriptorResult (DefaultDependencyCollector.java:526)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:413)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:365)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:353)
    at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.collectDependencies (DefaultDependencyCollector.java:258)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies (DefaultRepositorySystem.java:300)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal (DefaultPluginDependenciesResolver.java:218)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:165)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm (DefaultMavenPluginManager.java:404)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm (DefaultMavenPluginManager.java:374)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm (DefaultBuildPluginManager.java:234)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:105)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:508)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:345)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    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:294)
    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:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants