diff --git a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpBuildListener.java b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpBuildListener.java index fd7d7666af..aa08802413 100644 --- a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpBuildListener.java +++ b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpBuildListener.java @@ -89,7 +89,7 @@ public void buildEnded(MavenSession session) { logger.info(project.getId() + " requires a version bump from " + currentVersion + " => " + newVersion); engine.setProjects(metadataReader.getProjects()); - engine.setUpdatePackageVersions(false); + engine.setUpdatePackageVersions(VersionBumpMojo.getUpdatePackages(session, project, projectHelper)); engine.addVersionChange(pomFile.getArtifactId(), newVersion); engine.apply(); bumped++; diff --git a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpMojo.java b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpMojo.java index 720684de04..7d79e3f09b 100644 --- a/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpMojo.java +++ b/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/VersionBumpMojo.java @@ -36,7 +36,7 @@ *
  • one can now run the build again with the incremented version and verify the automatic applied * changes
  • * - * + * */ @Mojo(name = VersionBumpMojo.NAME, threadSafe = true, defaultPhase = LifecyclePhase.VERIFY, requiresProject = true) public class VersionBumpMojo extends AbstractMojo { @@ -47,10 +47,14 @@ public class VersionBumpMojo extends AbstractMojo { static final int DEFAULT_INCREMENT = 1; + static final boolean DEFAULT_UPDATE_PACKAGES = false; + static final String NAME = "bump-versions"; static final String PROPERTY_INCREMENT = "tycho." + NAME + ".increment"; + static final String PROPERTY_UPDATE_PACKAGES = "tycho." + NAME + ".updatePackages"; + /** * Configures the default increment of micro version to use if no version is recommended by the * VersionBumpRequiredException produced by the version check plugin. @@ -58,6 +62,13 @@ public class VersionBumpMojo extends AbstractMojo { @Parameter(property = PROPERTY_INCREMENT, defaultValue = DEFAULT_INCREMENT + "") private int increment = DEFAULT_INCREMENT; + /** + * Configures whether to update exported packages to the version recommended by the + * VersionBumpRequiredException produced by the version check plugin. + */ + @Parameter(property = PROPERTY_UPDATE_PACKAGES, defaultValue = DEFAULT_UPDATE_PACKAGES + "") + private boolean updatePackages = DEFAULT_UPDATE_PACKAGES; + @Override public void execute() throws MojoExecutionException, MojoFailureException { //actual work is performed in VersionBumpBuildListener @@ -79,4 +90,20 @@ public static int getIncrement(MavenSession mavenSession, MavenProject project, return DEFAULT_INCREMENT; } + public static boolean getUpdatePackages(MavenSession mavenSession, MavenProject project, ProjectHelper projectHelper) { + String prop = mavenSession.getUserProperties().getProperty(PROPERTY_UPDATE_PACKAGES); + if (prop != null) { + return Boolean.parseBoolean(prop); + } + Xpp3Dom configuration = projectHelper.getPluginConfiguration(GROUP_ID, ARTIFACT_ID, NAME, project, + mavenSession); + if (configuration != null) { + Xpp3Dom child = configuration.getChild("updatePackages"); + if (child != null) { + return Boolean.parseBoolean(child.getValue()); + } + } + return DEFAULT_UPDATE_PACKAGES; + } + }