001    package org.apache.maven.tools.plugin.annotations;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
023    import org.apache.maven.plugin.AbstractMojo;
024    import org.apache.maven.plugin.MojoExecutionException;
025    import org.apache.maven.plugin.MojoFailureException;
026    import org.apache.maven.plugins.annotations.Component;
027    import org.apache.maven.plugins.annotations.Execute;
028    import org.apache.maven.plugins.annotations.LifecyclePhase;
029    import org.apache.maven.plugins.annotations.Mojo;
030    import org.apache.maven.plugins.annotations.Parameter;
031    import org.codehaus.plexus.compiler.manager.CompilerManager;
032    
033    /**
034     * @author Olivier Lamy
035     */
036    @Mojo( name = "foo", defaultPhase = LifecyclePhase.COMPILE, threadSafe = true )
037    @Execute( goal = "compiler", lifecycle = "my-lifecycle", phase = LifecyclePhase.PACKAGE )
038    public class FooMojo
039        extends AbstractMojo
040    {
041        /**
042         * the cool bar to go
043         * @since 1.0
044         */
045        @Parameter( property = "thebar", required = true, defaultValue = "coolbar" )
046        protected String bar;
047    
048        /**
049         * beer for non french folks
050         * @deprecated wine is better
051         */
052        @Parameter( property = "thebeer", defaultValue = "coolbeer" )
053        protected String beer;
054    
055        /**
056         * Plexus compiler manager.
057         */
058        @Component
059        protected CompilerManager compilerManager;
060    
061        /**
062         *
063         */
064        @Component( role = ArtifactMetadataSource.class, hint = "maven" )
065        protected ArtifactMetadataSource artifactMetadataSource;
066    
067        public void execute()
068            throws MojoExecutionException, MojoFailureException
069        {
070            // nothing
071        }
072    }