1 package org.apache.maven.plugins.mavenone;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.maven.model.converter.Maven1Converter;
23 import org.apache.maven.model.converter.ProjectConverterException;
24 import org.apache.maven.plugin.AbstractMojo;
25 import org.apache.maven.plugin.MojoExecutionException;
26 import org.apache.maven.plugin.MojoFailureException;
27
28 import java.io.File;
29
30 /**
31 * Convert a Maven 1 project.xml (v3 pom) to a Maven 2 pom.xml (v4 pom).
32 *
33 * @author Fabrizio Giustina
34 * @author Dennis Lundberg
35 * @version $Id: PomV3ConvertMojo.java 728546 2008-12-21 22:56:51Z bentmann $
36 * @goal convert
37 * @requiresProject false
38 * @since 1.1
39 */
40 public class PomV3ConvertMojo extends AbstractMojo
41 {
42 /**
43 * Project basedir.
44 *
45 * @parameter expression="${basedir}"
46 * @required
47 * @readonly
48 */
49 private File basedir;
50
51 /**
52 * The converter to use.
53 *
54 * @component
55 */
56 private Maven1Converter converter;
57
58 /**
59 * @see org.apache.maven.plugin.Mojo#execute()
60 */
61 public void execute()
62 throws MojoExecutionException, MojoFailureException
63 {
64 converter.setBasedir( basedir );
65
66 try
67 {
68 converter.execute();
69 }
70 catch ( ProjectConverterException e )
71 {
72 throw new MojoExecutionException( "An exception occured while converting the Maven 1 project", e );
73 }
74 }
75 }