1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.artifact.buildinfo;
20
21 import java.util.Map;
22
23 import org.apache.maven.artifact.Artifact;
24 import org.apache.maven.plugin.MojoExecutionException;
25 import org.apache.maven.plugins.annotations.Component;
26 import org.apache.maven.plugins.annotations.LifecyclePhase;
27 import org.apache.maven.plugins.annotations.Mojo;
28 import org.apache.maven.plugins.annotations.Parameter;
29 import org.apache.maven.project.MavenProjectHelper;
30
31
32
33
34
35
36 @Mojo(name = "buildinfo", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
37 public class BuildinfoMojo extends AbstractBuildinfoMojo {
38
39
40
41 @Parameter(property = "buildinfo.attach", defaultValue = "true")
42 private boolean attach;
43
44
45
46
47 @Component
48 private MavenProjectHelper projectHelper;
49
50 @Override
51 public void execute(Map<Artifact, String> artifacts) throws MojoExecutionException {
52
53 if (attach) {
54 getLog().info("Attaching buildinfo");
55 projectHelper.attachArtifact(project, "buildinfo", buildinfoFile);
56 } else {
57 getLog().info("NOT adding buildinfo to the list of attached artifacts.");
58 }
59 }
60 }