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

#568 introduce updateBuildOutputTimestamp property to make it configurable whether project.build.outputTimestamp is updated or not #570

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:set -DnewVersion=2.0 -DupdateBuildOutputTimestamp=false
14 changes: 14 additions & 0 deletions src/it/it-set-020-outputTimestamp-disabled/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-set-020-outputTimestamp-disabled</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>set</name>

<properties>
<project.build.outputTimestamp>10</project.build.outputTimestamp>
</properties>
</project>
4 changes: 4 additions & 0 deletions src/it/it-set-020-outputTimestamp-disabled/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pom = new File( basedir, "pom.xml" ).text;

// expect outputTimestamp to be untouched
assert pom =~ /<project.build.outputTimestamp>10<.project.build.outputTimestamp>/
14 changes: 12 additions & 2 deletions src/main/java/org/codehaus/mojo/versions/SetMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ public class SetMojo
@Parameter( property = "processFromLocalAggregationRoot", defaultValue = "true" )
private boolean processFromLocalAggregationRoot;

/**
* Whether to update the <code>project.build.outputTimestamp<code> property in the POM when setting version.
*
* @since 2.10
*/
@Parameter( property = "updateBuildOutputTimestamp", defaultValue = "true" )
private boolean updateBuildOutputTimestamp;

/**
* The changes to module coordinates. Guarded by this.
*/
Expand Down Expand Up @@ -506,8 +514,10 @@ protected synchronized void update( ModifiedPomXMLEventReader pom )
{
changer.apply( versionChange );

// also update project.build.outputTimestamp
updateBuildOutputTimestamp( pom, model );
if (updateBuildOutputTimestamp) {
// also update project.build.outputTimestamp
updateBuildOutputTimestamp( pom, model );
}
}
}
catch ( IOException e )
Expand Down