|
| 1 | +package org.apache.maven.its.v4api; |
| 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.api.MojoExecution; |
| 23 | +import org.apache.maven.api.ResolutionScope; |
| 24 | +import org.apache.maven.api.Session; |
| 25 | +import org.apache.maven.api.plugin.Log; |
| 26 | +import org.apache.maven.api.plugin.MojoException; |
| 27 | +import org.apache.maven.api.plugin.annotations.Component; |
| 28 | +import org.apache.maven.api.plugin.annotations.Execute; |
| 29 | +import org.apache.maven.api.plugin.annotations.LifecyclePhase; |
| 30 | +import org.apache.maven.api.plugin.annotations.Mojo; |
| 31 | +import org.apache.maven.api.plugin.annotations.Parameter; |
| 32 | +import org.apache.maven.api.Project; |
| 33 | +import org.apache.maven.api.services.ArtifactInstaller; |
| 34 | +import org.apache.maven.api.settings.Settings; |
| 35 | + |
| 36 | +import java.nio.file.Path; |
| 37 | + |
| 38 | +/** |
| 39 | + * Test mojo for the v4 api plugin descriptor generation. |
| 40 | + * This mojo is not actually runnable because: |
| 41 | + * - it's using a custom lifecycle which is not defined |
| 42 | + * - it has a @Component dependency on ArtifactInstaller (hint=test) which does not exist |
| 43 | + * |
| 44 | + * @since 1.2 |
| 45 | + */ |
| 46 | +@Mojo( name = "first", requiresDependencyResolution = ResolutionScope.TEST, |
| 47 | + defaultPhase = LifecyclePhase.INTEGRATION_TEST ) |
| 48 | +@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" ) |
| 49 | +public class FirstMojo |
| 50 | + implements org.apache.maven.api.plugin.Mojo |
| 51 | +{ |
| 52 | + |
| 53 | + /** |
| 54 | + * Project directory. |
| 55 | + */ |
| 56 | + @Parameter( defaultValue = "${basedir}", readonly = true ) |
| 57 | + private Path basedir; |
| 58 | + |
| 59 | + @Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt", |
| 60 | + required = true ) |
| 61 | + private Path touchFile; |
| 62 | + |
| 63 | + /** |
| 64 | + * @since 0.1 |
| 65 | + * @deprecated As of 0.2 |
| 66 | + */ |
| 67 | + @Deprecated |
| 68 | + @Parameter( name = "namedParam", alias = "alias" ) |
| 69 | + private String aliasedParam; |
| 70 | + |
| 71 | + @Component |
| 72 | + private Session session; |
| 73 | + |
| 74 | + @Component |
| 75 | + private Project project; |
| 76 | + |
| 77 | + @Component |
| 78 | + private MojoExecution mojo; |
| 79 | + |
| 80 | + @Component |
| 81 | + private Settings settings; |
| 82 | + |
| 83 | + @Component |
| 84 | + private Log log; |
| 85 | + |
| 86 | + @Component( role = ArtifactInstaller.class, hint = "test" ) |
| 87 | + private Object custom; |
| 88 | + |
| 89 | + public void execute() |
| 90 | + throws MojoException |
| 91 | + { |
| 92 | + } |
| 93 | + |
| 94 | +} |
0 commit comments