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

Inconsistency between dependency-updates and property-updates #872

Closed
javier-godoy opened this issue Dec 21, 2022 · 5 comments · Fixed by #873
Closed

Inconsistency between dependency-updates and property-updates #872

javier-godoy opened this issue Dec 21, 2022 · 5 comments · Fixed by #873
Labels
Milestone

Comments

@javier-godoy
Copy link

Even if allowSnapshots is true, display-dependency-updates only detects newer dependencies up to the last release (even if there are newer snapshots), while display-property-updates is able to report the newer snapshots

For instance, if the "Snapshots" repository has com.example:foo:2.9.1-SNAPSHOT and 2.9.2-SNAPSHOT and the "Releases" repository has version 2.9.1, I get

mvn versions:display-dependency-updates
[INFO] The following dependencies in Dependencies have newer versions:
[INFO]   com.example:foo .... 2.9.1-SNAPSHOT -> 2.9.1

mvn versions:display-property-updates
[INFO] The following version property updates are available:
[INFO]   ${com-example-foo.version} ......... 2.9.1-SNAPSHOT -> 2.9.2-SNAPSHOT
<repositories>
    <repository>
		<id>Releases</id>
		<url>https://example.com/releases</url>
	</repository>
	<repository>
		<id>Snapshots</id>
		<url>https://example.com/snapshots</url>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
		<releases>
			<enabled>false</enabled>
		</releases>
	</repository>
</repositories>

...

<dependency>
	<groupId>com.example</groupId>
	<artifactId>foo</artifactId>
	<version>${com-example-foo.version}</version>					
</dependency>

...
		
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>versions-maven-plugin</artifactId>
	<version>2.14.1</version>
	<configuration>
		<allowSnapshots>true</allowSnapshots>
	</configuration>
</plugin>				
@jarmoniuk
Copy link
Contributor

jarmoniuk commented Dec 22, 2022

Confirmed. The parameter is indeed not passed to ArtifactVersions.includeSnashots

@jarmoniuk
Copy link
Contributor

jarmoniuk commented Dec 22, 2022

@slawekjaranowski looks like it's going to be a sizeable update. Luckily the change is simple and it should be easy to review.

The reason is ArtifactVersions.includeSnapshots, which is used for reports, which is often assumed as true/false, depending on the mojo, and often forgotten. Also, method overloading with wrong assumptions about the default argument values.

So, I've cleaned it up a bit, removed ArtifactVersions.includeSnapshots, made allowSnapshots obligatory for VersionsHelper.get...Updates so that it's clear what we're getting every time. And for reports, made allowSnapshots an argument to the render method. Now it's clear what we're getting.

I haven't checked if it's a fresh regression, but I suspect it has been there for quite some time, maybe even since the beginning of some of the mojos.

@jarmoniuk
Copy link
Contributor

@javier-godoy thanks for the report.

@slawekjaranowski
Copy link
Member

If it looks as a bigger update, I would like to postpone after next bug fix release.

@ajarmoniuk - You wrote, that you have done, so please create PR - we will see how big is.

@jarmoniuk
Copy link
Contributor

Yes, just doing all the needful checks first.

jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 22, 2022
@slawekjaranowski slawekjaranowski added this to the 2.14.2 milestone Dec 22, 2022
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Dec 23, 2022
slawekjaranowski pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants