You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2022/06/15 08:09:02 UTC

[camel-k] branch main updated: configuring maven builds based on CPU quota if set any

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new de1088e74 configuring maven builds based on CPU quota if set any
de1088e74 is described below

commit de1088e74169b2c9e5b639ff40534bd9ae3abb61
Author: Subhasmita Swain <su...@gmail.com>
AuthorDate: Thu Jun 9 00:30:03 2022 +0530

    configuring maven builds based on CPU quota if set any
---
 pkg/util/maven/maven_command.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pkg/util/maven/maven_command.go b/pkg/util/maven/maven_command.go
index c6ca43697..750c4b786 100644
--- a/pkg/util/maven/maven_command.go
+++ b/pkg/util/maven/maven_command.go
@@ -26,6 +26,8 @@ import (
 	"os/exec"
 	"path"
 	"regexp"
+	"runtime"
+	"strconv"
 	"strings"
 
 	"github.com/pkg/errors"
@@ -74,6 +76,14 @@ func (c *Command) Do(ctx context.Context) error {
 		args = append(args, "--settings", settingsPath)
 	}
 
+	if !util.StringContainsPrefix(c.context.AdditionalArguments, "-Dmaven.artifact.threads") {
+		args = append(args, "-Dmaven.artifact.threads="+strconv.Itoa(runtime.GOMAXPROCS(0)))
+	}
+
+	if !util.StringSliceExists(c.context.AdditionalArguments, "-T") {
+		args = append(args, "-T", strconv.Itoa(runtime.GOMAXPROCS(0)))
+	}
+
 	cmd := exec.CommandContext(ctx, mvnCmd, args...)
 	cmd.Dir = c.context.Path