001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020 package org.apache.geronimo.genesis.plugins.tools;
021
022 import org.apache.geronimo.genesis.MojoSupport;
023 import org.apache.maven.project.MavenProject;
024 import org.apache.maven.artifact.Artifact;
025
026 import java.io.File;
027
028 /**
029 * Helper to install a specific file (or the projects pom) as the projects artifact file.
030 *
031 * <p>
032 * Custom packaging will need to define a artifact handler plexus component to map desired file extention.
033 * </p>
034 *
035 * @goal set-artifact-file
036 * @phase package
037 *
038 * @version $Rev: 452992 $ $Date: 2006-10-04 12:53:30 -0700 (Wed, 04 Oct 2006) $
039 */
040 public class SetProjectFileMojo
041 extends MojoSupport
042 {
043 /**
044 * The maven project.
045 *
046 * @parameter expression="${project}"
047 * @required
048 * @readonly
049 */
050 protected MavenProject project;
051
052 /**
053 * The target file to set as the project's artifact.
054 *
055 * @parameter expression="${project.file}"
056 * @required
057 */
058 private File targetFile;
059
060 protected void doExecute() throws Exception {
061 log.info("Setting artifact file: " + targetFile);
062
063 Artifact artifact = project.getArtifact();
064 artifact.setFile(targetFile);
065 }
066 }