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

Regression in 2.14.2: version not updated #888

Closed
bangert opened this issue Dec 30, 2022 · 10 comments · Fixed by #889
Closed

Regression in 2.14.2: version not updated #888

bangert opened this issue Dec 30, 2022 · 10 comments · Fixed by #889

Comments

@bangert
Copy link

bangert commented Dec 30, 2022

I am currently investigating what i believe to be a regression in versions-maven-plugin 2.14.2.

Basically versions:set no longer seems to work as designed:

+ mvn versions:set -DnewVersion=2.0.6-UpdateVersionsPlugin-SNAPSHOT -DoldVersion=*
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< com.somewhere.di:di-business-model >-----------------
[INFO] Building di-business-model 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:2.14.2:set (default-cli) @ di-business-model ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: /home/jenkins/workspace/iness-model_UpdateVersionsPlugin
[INFO] Processing change of com.somewhere.di:di-business-model:* -> 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.905 s
[INFO] Finished at: 2022-12-30T12:01:03+01:00
[INFO] -----------------------------------------------------------------------

the version is unaffected after this

This works in 2.14.1:

+ mvn versions:set -DnewVersion=2.0.6-UpdateVersionsPlugin-SNAPSHOT -DoldVersion=*
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< com.somewhere.di:di-business-model >-----------------
[INFO] Building di-business-model 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:2.14.1:set (default-cli) @ di-business-model ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: /home/jenkins/workspace/iness-model_UpdateVersionsPlugin
[INFO] Processing change of com.somewhere.di:di-business-model:* -> 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] Processing com.somewhere.di:di-business-model
[INFO]     Updating project com.somewhere.di:di-business-model
[INFO]         from version  to 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.734 s
[INFO] Finished at: 2022-12-30T11:50:35+01:00
[INFO] ------------------------------------------------------------------------

Unfortunately this only fails when run in our Jenkins.
I am still investigating this. Any suggestions appreciated.

@andrzejj0
Copy link
Contributor

Please providee the pom which you're acting upon. And please use the -X option of maven and attach the output.

The only change regarding set in 2.14.2 is #855. Is your dependency using a parameter?

@bangert
Copy link
Author

bangert commented Dec 30, 2022

here is a minimal pom:

<?xml version="1.0" encoding="UTF-8"?>
<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>com.somewhere.di</groupId>
	<artifactId>di-business-model</artifactId>
	<version>${revision}${sha1}${changelist}</version>
	<name>di-business-model</name>
	<description>Business Model Objects for DI</description>

	<properties>
		<revision>2.0.6</revision>
		<!-- the CI system uses the sha1 property for the branch name - unused
			in local builds -->
		<sha1></sha1>
		<changelist>-SNAPSHOT</changelist>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
	</properties>

	<build>
		<plugins>
			<plugin>
				<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/versions-maven-plugin -->
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>versions-maven-plugin</artifactId>
				<version>2.14.2</version>
			</plugin>
		</plugins>
	</build>
</project>

@andrzejj0
Copy link
Contributor

andrzejj0 commented Dec 30, 2022

Can't reproduce with maven 3.8.6:

[INFO] Searching for local aggregator root...
[DEBUG] Checking to see if /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it is an aggregator parent
[DEBUG] Local aggregation root is /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888
[INFO] Local aggregation root: /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888
[DEBUG] Finding child modules...
[DEBUG] Child modules:
[DEBUG] None.
[INFO] Processing change of com.somewhere.di:di-business-model:* -> 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[DEBUG] Applying change com.somewhere.di:di-business-model: -> 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[DEBUG] Processing /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888/pom.xml as a parent.
[DEBUG] Looking for modules which use com.somewhere.di:di-business-model as their parent
[INFO] Processing com.somewhere.di:di-business-model
[INFO]     Updating project com.somewhere.di:di-business-model
[INFO]         from version  to 2.0.6-UpdateVersionsPlugin-SNAPSHOT
[INFO] 
[DEBUG] Backing up /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888/pom.xml to /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888/pom.xml.versionsBackup
[DEBUG] writing change record to /Users/ajarmoniuk/IdeaProjects/versions-maven-plugin-2/versions-maven-plugin/target/it/it-set-issue-888/target/versions-changes.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.656 s
[INFO] Finished at: 2022-12-30T15:28:59+01:00
[INFO] ------------------------------------------------------------------------
<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>com.somewhere.di</groupId>
  <artifactId>di-business-model</artifactId>
  <version>2.0.6-UpdateVersionsPlugin-SNAPSHOT</version>
  <name>di-business-model</name>
  <description>Business Model Objects for DI</description>

  <properties>
    <revision>2.0.6</revision>
    <!-- the CI system uses the sha1 property for the branch name - unused
      in local builds -->
    <sha1></sha1>
    <changelist>-SNAPSHOT</changelist>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
  </properties>

  <build>
    <plugins>
      <plugin>
        <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/versions-maven-plugin -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>2.14.2</version>
      </plugin>
    </plugins>
  </build>
</project>

Once again, please attach debug logs.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Dec 30, 2022

Your project uses CI friendly versions, and properties get resolved in 2.14.2. That's the main difference against 2.14.1. There will be no substitution if the resolved value happens to be the same as the original value.

Since this only happens on the CI/CD env, I guess it might have to do with it. Your pom.xml says that the sha1 will assume the value of the branch name; if that happens to be UpdateVersionsPlugin, then the file is not going to be changed.

@bangert bangert changed the title Regression in 2.14.2 ? Regression in 2.14.2: version not updated Dec 30, 2022
@bangert
Copy link
Author

bangert commented Dec 30, 2022

your analysis seems correct - 2.14.2 no longer updates the version if you set it to the value that it currently resolves to.
Thank you for finding it.

Unfortunately we specifically need to set the resolved version, since some tools later in the pipeline cant handle variables in the version :-/

@andrzejj0
Copy link
Contributor

Gotcha. I recommend fixing the plugin version until we patch this or there's a workaround.

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Dec 30, 2022
…Properties

- allows to disable property interpolation, so that it's possible to match against raw property values as well as replace properties with interpolated values if the value is the same as the property value
@eitan-rosenberg
Copy link

Hi,

I just replaced apache-maven-3.8.6 with apache-maven-3.8.7.

I got a fresh repository.

I am using org.apache.maven.shared.invoker.DefaultInvoker to run maven programmatically for some years now with no problems.

I post my goals using org.apache.maven.shared.invoker.DefaultInvocationRequest.
the is set to show Errors (invocationRequest.setShowErrors(true));

When using "versions:use-next-releases" the invoker fail.

I am including the log:
Document07.txt

please help...

Happy new year

@andrzejj0
Copy link
Contributor

Please create a new issue.

@eitan-rosenberg
Copy link

Ok.
Thank you.

slawekjaranowski pushed a commit that referenced this issue Jan 8, 2023
- allows to disable property interpolation, so that it's possible to match against raw property values as well as replace properties with interpolated values if the value is the same as the property value
@bangert
Copy link
Author

bangert commented Jan 10, 2023

Thank you everybody - much appreciated!

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