Skip to content

Commit

Permalink
Hotfix/171 (#379)
Browse files Browse the repository at this point in the history
* Adds Maven debug log option for openrewrite

Signed-off-by: Juanma Barea <[email protected]>

* Changes maven debug argument type

Signed-off-by: Juanma Barea <[email protected]>

---------

Signed-off-by: Juanma Barea <[email protected]>
  • Loading branch information
JuanmaBM authored Nov 22, 2024
1 parent 9e6d2f7 commit dd94c3b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/openrewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type openRewriteCommand struct {
log logr.Logger
cleanup bool
mavenSettingsFile string
mavenDebugLog bool
}

func NewOpenRewriteCommand(log logr.Logger) *cobra.Command {
Expand Down Expand Up @@ -61,6 +62,7 @@ func NewOpenRewriteCommand(log logr.Logger) *cobra.Command {
openRewriteCommand.Flags().StringVarP(&openRewriteCmd.goal, "goal", "g", "dryRun", "target goal")
openRewriteCommand.Flags().StringVarP(&openRewriteCmd.input, "input", "i", "", "path to application source code directory")
openRewriteCommand.Flags().StringVarP(&openRewriteCmd.mavenSettingsFile, "maven-settings", "s", "", "path to a custom maven settings file to use")
openRewriteCommand.Flags().BoolVarP(&openRewriteCmd.mavenDebugLog, "maven debug log level", "x", false, "enable Maven debug logging")

return openRewriteCommand
}
Expand Down Expand Up @@ -151,6 +153,10 @@ func (o *openRewriteCommand) Run(ctx context.Context) error {
o.log.Info("using custom maven settings file", "path", o.mavenSettingsFile)
args = append(args, "-s", o.mavenSettingsFile)
}
if o.mavenDebugLog {
o.log.Info("Setting Maven log to debug")
args = append(args, "-X")
}

err := container.NewContainer().Run(
ctx,
Expand Down

0 comments on commit dd94c3b

Please sign in to comment.