1 /* 2 * Copyright 2012 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.maven.bugzilla; 17 18 import org.apache.maven.plugin.MojoExecutionException; 19 import org.apache.maven.plugin.MojoFailureException; 20 import org.apache.maven.project.MavenProject; 21 22 import de.smartics.maven.issue.util.VersionHelper; 23 24 /** 25 * Helper to sync version information. 26 */ 27 final class MojoHelperSync extends AbstractMojoHelper 28 { 29 30 // ********************************* Fields ********************************* 31 32 // --- constants ------------------------------------------------------------ 33 34 // --- members -------------------------------------------------------------- 35 36 // ****************************** Initializer ******************************* 37 38 // ****************************** Constructors ****************************** 39 40 /** 41 * Default constructor. 42 * 43 * @param project the Maven project. 44 * @param commandFactory the helper to create commands. 45 * @param console the console to execute commands. 46 * @see de.smartics.maven.bugzilla.AbstractMojoHelper#AbstractMojoHelper(org.apache.maven.project.MavenProject, 47 * de.smartics.maven.bugzilla.MavenCommandFactory, 48 * de.smartics.maven.bugzilla.Console) 49 */ 50 protected MojoHelperSync(final MavenProject project, 51 final MavenCommandFactory commandFactory, final Console console) 52 { 53 super(project, commandFactory, console); 54 } 55 56 // ****************************** Inner Classes ***************************** 57 58 // ********************************* Methods ******************************** 59 60 // --- init ----------------------------------------------------------------- 61 62 // --- get&set -------------------------------------------------------------- 63 64 // --- business ------------------------------------------------------------- 65 66 /** 67 * {@inheritDoc} 68 */ 69 void execute(final String releasedVersion) throws MojoExecutionException, 70 MojoFailureException 71 { 72 final String product = project.getArtifactId(); 73 74 final MojoHelperVersion versionHelper = 75 new MojoHelperVersion(project, commandFactory, console); 76 versionHelper.run(product, releasedVersion); 77 78 final VersionHelper helper = new VersionHelper(releasedVersion); 79 final MojoHelperMilestone milestoneHelper = 80 new MojoHelperMilestone(project, commandFactory, console); 81 82 final String micro = helper.calculateNextVersion("MICRO"); 83 milestoneHelper.run(product, micro, null); 84 final String minor = helper.calculateNextVersion("MINOR"); 85 milestoneHelper.run(product, minor, null); 86 final String major = helper.calculateNextVersion("MAJOR"); 87 milestoneHelper.run(product, major, null); 88 } 89 90 // --- object basics -------------------------------------------------------- 91 92 }