View Javadoc

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  /**
23   * Adds and initializes this project as new product on the issue management
24   * server.
25   *
26   * @goal init
27   * @requiresProject
28   * @threadSafe
29   * @since 1.0
30   * @description Adds this project as a new product on the issue management
31   *              server and runs a default initialization process that adds
32   *              versions according to the best practices.
33   */
34  public class InitProductMojo extends AddProductMojo
35  {
36    // ********************************* Fields *********************************
37  
38    // --- constants ------------------------------------------------------------
39  
40    // --- members --------------------------------------------------------------
41  
42    // ****************************** Initializer *******************************
43  
44    // ****************************** Constructors ******************************
45  
46    // ****************************** Inner Classes *****************************
47  
48    // ********************************* Methods ********************************
49  
50    // --- init -----------------------------------------------------------------
51  
52    // --- get&set --------------------------------------------------------------
53  
54    // --- business -------------------------------------------------------------
55  
56    /**
57     * {@inheritDoc}
58     */
59    public final void run() throws MojoExecutionException, MojoFailureException
60    {
61      super.run();
62  
63      final MavenProject project = getProject();
64      final String product = project.getArtifactId();
65  
66      final MojoHelperVersion versionHelper =
67          new MojoHelperVersion(project, commandFactory, console);
68      versionHelper.run(product, "SNAPSHOT");
69  
70      final MojoHelperMilestone milestoneHelper =
71          new MojoHelperMilestone(project, commandFactory, console);
72      milestoneHelper.run(product, "CURRENT", null);
73      milestoneHelper.run(product, "MINOR", null);
74      milestoneHelper.run(product, "MAJOR", null);
75    }
76  
77    // --- object basics --------------------------------------------------------
78  
79  }