@@ -46,7 +46,7 @@ func (b *Builder) buildJibMavenToDocker(ctx context.Context, out io.Writer, work
46
46
}
47
47
48
48
skaffoldImage := generateJibImageRef (workspace , artifact .Module )
49
- args := generateMavenArgs ("dockerBuild" , skaffoldImage , artifact )
49
+ args := jib . GenerateMavenArgs ("dockerBuild" , skaffoldImage , artifact )
50
50
51
51
if err := runMavenCommand (ctx , out , workspace , args ); err != nil {
52
52
return "" , err
@@ -65,7 +65,7 @@ func (b *Builder) buildJibMavenToRegistry(ctx context.Context, out io.Writer, wo
65
65
66
66
initialTag := util .RandomID ()
67
67
skaffoldImage := fmt .Sprintf ("%s:%s" , artifact .ImageName , initialTag )
68
- args := generateMavenArgs ("build" , skaffoldImage , artifact .JibMavenArtifact )
68
+ args := jib . GenerateMavenArgs ("build" , skaffoldImage , artifact .JibMavenArtifact )
69
69
70
70
if err := runMavenCommand (ctx , out , workspace , args ); err != nil {
71
71
return "" , err
@@ -74,24 +74,6 @@ func (b *Builder) buildJibMavenToRegistry(ctx context.Context, out io.Writer, wo
74
74
return docker .RemoteDigest (skaffoldImage )
75
75
}
76
76
77
- // generateMavenArgs generates the arguments to Maven for building the project as an image called `skaffoldImage`.
78
- func generateMavenArgs (goal string , imageName string , artifact * latest.JibMavenArtifact ) []string {
79
- var command []string
80
- if artifact .Module == "" {
81
- // single-module project
82
- command = []string {"--non-recursive" , "prepare-package" , "jib:" + goal }
83
- } else {
84
- // multi-module project: we assume `package` is bound to `jib:<goal>`
85
- command = []string {"--projects" , artifact .Module , "--also-make" , "package" }
86
- }
87
- command = append (command , "-Dimage=" + imageName )
88
- if artifact .Profile != "" {
89
- command = append (command , "--activate-profiles" , artifact .Profile )
90
- }
91
-
92
- return command
93
- }
94
-
95
77
// verifyJibPackageGoal verifies that the referenced module has `package` bound to a single jib goal.
96
78
// It returns `nil` if the goal is matched, and an error if there is a mismatch.
97
79
func verifyJibPackageGoal (ctx context.Context , requiredGoal string , workspace string , artifact * latest.JibMavenArtifact ) error {
0 commit comments