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