18
18
*/
19
19
package org .apache .maven .plugins .artifact .buildinfo ;
20
20
21
+ import javax .inject .Inject ;
22
+
21
23
import java .io .BufferedWriter ;
22
24
import java .io .File ;
23
25
import java .io .IOException ;
31
33
import java .util .Map ;
32
34
import java .util .Properties ;
33
35
36
+ import org .apache .maven .execution .MavenSession ;
34
37
import org .apache .maven .plugin .MojoExecutionException ;
35
- import org .apache .maven .plugins .annotations .Component ;
36
38
import org .apache .maven .plugins .annotations .Mojo ;
37
39
import org .apache .maven .plugins .annotations .Parameter ;
38
40
import org .apache .maven .project .MavenProject ;
41
+ import org .apache .maven .rtinfo .RuntimeInformation ;
39
42
import org .apache .maven .shared .utils .logging .MessageUtils ;
43
+ import org .apache .maven .toolchain .ToolchainManager ;
40
44
import org .eclipse .aether .RepositorySystem ;
41
45
import org .eclipse .aether .RepositorySystemSession ;
42
46
import org .eclipse .aether .artifact .Artifact ;
@@ -74,12 +78,6 @@ public class CompareMojo extends AbstractBuildinfoMojo {
74
78
@ Parameter (property = "compare.aggregate.only" , defaultValue = "false" )
75
79
private boolean aggregateOnly ;
76
80
77
- /**
78
- * The entry point to Maven Artifact Resolver, i.e. the component doing all the work.
79
- */
80
- @ Component
81
- private RepositorySystem repoSystem ;
82
-
83
81
/**
84
82
* The current repository/network configuration of Maven.
85
83
*/
@@ -99,6 +97,22 @@ public class CompareMojo extends AbstractBuildinfoMojo {
99
97
@ Parameter (property = "compare.fail" , defaultValue = "true" )
100
98
private boolean fail ;
101
99
100
+ /**
101
+ * The entry point to Maven Artifact Resolver, i.e. the component doing all the work.
102
+ */
103
+ private final RepositorySystem repoSystem ;
104
+
105
+ @ Inject
106
+ public CompareMojo (
107
+ ToolchainManager toolchainManager ,
108
+ RuntimeInformation rtInformation ,
109
+ MavenProject project ,
110
+ MavenSession session ,
111
+ RepositorySystem repoSystem ) {
112
+ super (toolchainManager , rtInformation , project , session );
113
+ this .repoSystem = repoSystem ;
114
+ }
115
+
102
116
@ Override
103
117
public void execute (Map <Artifact , String > artifacts ) throws MojoExecutionException {
104
118
getLog ().info ("Checking against reference build from " + referenceRepo + "..." );
0 commit comments