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

commit 0b5c87428642174d00d9ff217db91b56a0758f83
Author: John Poth <poth.j...@gmail.com>
AuthorDate: Mon Jun 7 18:39:19 2021 +0200

    Fix #2132: Allow Maven build extensions to be added
---
 config/crd/bases/camel.apache.org_builds.yaml      | 16 +++++++++++
 .../camel.apache.org_integrationplatforms.yaml     | 32 ++++++++++++++++++++++
 .../1.5.0-snapshot/camel.apache.org_builds.yaml    | 16 +++++++++++
 .../camel.apache.org_integrationplatforms.yaml     | 32 ++++++++++++++++++++++
 helm/camel-k/crds/crd-build.yaml                   | 16 +++++++++++
 helm/camel-k/crds/crd-integration-platform.yaml    | 32 ++++++++++++++++++++++
 pkg/apis/camel/v1/common_types.go                  |  8 ++++--
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |  5 ++++
 pkg/builder/quarkus.go                             |  3 ++
 pkg/cmd/install.go                                 | 22 +++++++++++++++
 pkg/resources/resources.go                         |  8 +++---
 pkg/util/maven/maven_types.go                      |  5 ++--
 12 files changed, 186 insertions(+), 9 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_builds.yaml 
b/config/crd/bases/camel.apache.org_builds.yaml
index c5e6364..b7f82ec 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -154,6 +154,22 @@ spec:
                               required:
                               - key
                               type: object
+                            extension:
+                              description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                              items:
+                                description: MavenArtifact --
+                                properties:
+                                  artifactId:
+                                    type: string
+                                  groupId:
+                                    type: string
+                                  version:
+                                    type: string
+                                required:
+                                - artifactId
+                                - groupId
+                                type: object
+                              type: array
                             localRepository:
                               description: The path of the local Maven 
repository.
                               type: string
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 9c9779f..50b5738 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -105,6 +105,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
@@ -321,6 +337,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
diff --git 
a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml 
b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
index c5e6364..b7f82ec 100644
--- a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
+++ b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_builds.yaml
@@ -154,6 +154,22 @@ spec:
                               required:
                               - key
                               type: object
+                            extension:
+                              description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                              items:
+                                description: MavenArtifact --
+                                properties:
+                                  artifactId:
+                                    type: string
+                                  groupId:
+                                    type: string
+                                  version:
+                                    type: string
+                                required:
+                                - artifactId
+                                - groupId
+                                type: object
+                              type: array
                             localRepository:
                               description: The path of the local Maven 
repository.
                               type: string
diff --git 
a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
 
b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
index 9c9779f..50b5738 100644
--- 
a/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
+++ 
b/deploy/olm-catalog/camel-k-dev/1.5.0-snapshot/camel.apache.org_integrationplatforms.yaml
@@ -105,6 +105,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
@@ -321,6 +337,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index c5e6364..b7f82ec 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -154,6 +154,22 @@ spec:
                               required:
                               - key
                               type: object
+                            extension:
+                              description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                              items:
+                                description: MavenArtifact --
+                                properties:
+                                  artifactId:
+                                    type: string
+                                  groupId:
+                                    type: string
+                                  version:
+                                    type: string
+                                required:
+                                - artifactId
+                                - groupId
+                                type: object
+                              type: array
                             localRepository:
                               description: The path of the local Maven 
repository.
                               type: string
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml 
b/helm/camel-k/crds/crd-integration-platform.yaml
index 9c9779f..50b5738 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -105,6 +105,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
@@ -321,6 +337,22 @@ spec:
                         required:
                         - key
                         type: object
+                      extension:
+                        description: Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+                        items:
+                          description: MavenArtifact --
+                          properties:
+                            artifactId:
+                              type: string
+                            groupId:
+                              type: string
+                            version:
+                              type: string
+                          required:
+                          - artifactId
+                          - groupId
+                          type: object
+                        type: array
                       localRepository:
                         description: The path of the local Maven repository.
                         type: string
diff --git a/pkg/apis/camel/v1/common_types.go 
b/pkg/apis/camel/v1/common_types.go
index 2bcc733..aeedb75 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -105,6 +105,8 @@ type MavenSpec struct {
        // Deprecated: use IntegrationPlatform.Spec.Build.Timeout instead
        Timeout      *metav1.Duration `json:"timeout,omitempty"`
        Repositories []Repository     `json:"repositories,omitempty"`
+       // Maven build extensions 
https://maven.apache.org/guides/mini/guide-using-extensions.html
+       Extension []MavenArtifact `json:"extension,omitempty"`
 }
 
 // ValueSource --
@@ -117,9 +119,9 @@ type ValueSource struct {
 
 // MavenArtifact --
 type MavenArtifact struct {
-       GroupID    string `json:"groupId" yaml:"groupId"`
-       ArtifactID string `json:"artifactId" yaml:"artifactId"`
-       Version    string `json:"version,omitempty" yaml:"version,omitempty"`
+       GroupID    string `json:"groupId" yaml:"groupId" xml:"groupId"`
+       ArtifactID string `json:"artifactId" yaml:"artifactId" xml:"artifactId"`
+       Version    string `json:"version,omitempty" yaml:"version,omitempty" 
xml:"version,omitempty"`
 }
 
 // RuntimeSpec --
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 0eb99d1..b345ede 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1277,6 +1277,11 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
                *out = make([]Repository, len(*in))
                copy(*out, *in)
        }
+       if in.Extension != nil {
+               in, out := &in.Extension, &out.Extension
+               *out = make([]MavenArtifact, len(*in))
+               copy(*out, *in)
+       }
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new MavenSpec.
diff --git a/pkg/builder/quarkus.go b/pkg/builder/quarkus.go
index f9bc2d9..6bdfecb 100644
--- a/pkg/builder/quarkus.go
+++ b/pkg/builder/quarkus.go
@@ -82,6 +82,9 @@ func generateQuarkusProject(ctx *builderContext) error {
        // Add all the properties from the build configuration
        p.Properties.AddAll(ctx.Build.Maven.Properties)
 
+       // Add Maven build extensions
+       p.Build.Extensions = ctx.Build.Maven.Extension
+
        // Add Maven repositories
        p.Repositories = append(p.Repositories, ctx.Build.Maven.Repositories...)
 
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 5c63979..26d3a16 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -114,6 +114,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *installCmdO
        // Maven
        cmd.Flags().String("maven-local-repository", "", "Path of the local 
Maven repository")
        cmd.Flags().StringArray("maven-property", nil, "Add a Maven property")
+       cmd.Flags().StringArray("maven-extension", nil, "Add a Maven build 
extension")
        cmd.Flags().String("maven-settings", "", "Configure the source of the 
Maven settings (configmap|secret:name[/key])")
        cmd.Flags().StringArray("maven-repository", nil, "Add a Maven 
repository")
        cmd.Flags().String("maven-ca-secret", "", "Configure the secret key 
containing the Maven CA certificates (secret/key)")
@@ -166,6 +167,7 @@ type installCmdOptions struct {
        BuildStrategy           string   `mapstructure:"build-strategy"`
        BuildPublishStrategy    string   `mapstructure:"build-publish-strategy"`
        BuildTimeout            string   `mapstructure:"build-timeout"`
+       MavenExtensions         []string `mapstructure:"maven-extensions"`
        MavenLocalRepository    string   `mapstructure:"maven-local-repository"`
        MavenProperties         []string `mapstructure:"maven-properties"`
        MavenRepositories       []string `mapstructure:"maven-repositories"`
@@ -321,6 +323,26 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
                                }
                        }
                }
+
+               if size := len(o.MavenExtensions); size > 0 {
+                       platform.Spec.Build.Maven.Extension = 
make([]v1.MavenArtifact, 0, size)
+                       for _, extension := range o.MavenExtensions {
+                               gav := strings.Split(extension, ":")
+                               if len(gav) != 2 && len(gav) != 3 {
+                                       meg := fmt.Sprintf("Maven build 
extension GAV must match <groupId>:<artifactId>:<version>, found: %s", 
extension)
+                                       return errors.New(meg)
+                               }
+                               ext := v1.MavenArtifact{
+                                       GroupID:    gav[0],
+                                       ArtifactID: gav[1],
+                               }
+                               if len(gav) == 3 {
+                                       ext.Version = gav[2]
+                               }
+                               platform.Spec.Build.Maven.Extension = 
append(platform.Spec.Build.Maven.Extension, ext)
+                       }
+               }
+
                if o.MavenLocalRepository != "" {
                        platform.Spec.Build.Maven.LocalRepository = 
o.MavenLocalRepository
                }
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 7c77381..bec6ab4 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -78,9 +78,9 @@ var assets = func() http.FileSystem {
                "/crd/bases/camel.apache.org_builds.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_builds.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 25360,
+                       uncompressedSize: 26168,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5d\x73\xdb\x3a\x76\xef\xfa\x15\x67\xe2\x87\x24\x33\x16\x75\xef\xdd\xdd\xf6\x56\x7d\xe8\x68\x95\x64\xaa\x26\xb1\x3d\x96\x72\xb7\xfb\x78\x44\x1e\x51\x58\x91\x00\x0b\x80\x96\xb5\x9d\xfe\xf7\x0e\x00\x52\xa2\x24\x7e\x80\xb6\xbc\xeb\x76\x8d\x97\xc4\x14\x70\x70\xbe\x70\xbe\xf0\x71\x05\xc3\xcb\xb5\xc1\x15\x7c\x63\x21\x71\x45\x11\x68\x01\x7a\x4d\x30\xc9\x30\x5c\x13\xcc\xc5\x4a\x6f\x51\x12\x7c\x11\x39\x8f\x50\x33\xc1\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5b\x73\xdb\x3c\x76\xef\xfa\x15\x67\xe2\x87\x24\x33\x16\x95\x7c\xbb\xdb\x7e\x55\x1f\x3a\x5a\x39\x99\xaa\x49\x6c\x8f\xa5\x7c\xdb\x7d\x3c\x22\x8f\x28\xac\x48\x80\x05\x40\xcb\xda\x4e\xff\x7b\x07\x00\x29\x51\x16\x2f\xa0\x2d\xf7\x73\x5b\xe3\x25\x31\x05\x1c\x9c\x1b\xce\x0d\x97\x0b\x18\x9e\xaf\x0d\x2e\xe0\x3b\x0b\x89\x2b\x8a\x40\x0b\xd0\x6b\x82\x49\x86\xe1\x9a\x60\x2e\x56\x7a\x8b\x92\xe0\xab\xc8\x79\x84\x9a\x09\x0e\x
 [...]
                },
                "/crd/bases/camel.apache.org_camelcatalogs.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_camelcatalogs.yaml",
@@ -99,9 +99,9 @@ var assets = func() http.FileSystem {
                "/crd/bases/camel.apache.org_integrationplatforms.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             
"camel.apache.org_integrationplatforms.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 23926,
+                       uncompressedSize: 25350,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5b\x93\xdb\xb6\xd5\xef\xfa\x15\x67\xac\x07\x27\x33\x2b\x2a\xf9\xbe\x76\xda\xaa\x0f\x1d\x45\xb6\xa7\xaa\xed\xdd\x9d\x95\x9c\x34\x8f\x10\x79\x44\x21\x02\x01\x16\x00\x57\x56\x3a\xfd\xef\x9d\x03\x90\x12\x25\xf1\xa6\xdd\xcd\xd4\x13\x13\x2f\xbb\x22\x81\x83\x73\xbf\x00\x67\x38\x84\xd1\xcb\x8d\xc1\x10\x3e\xf0\x10\xa5\xc1\x08\xac\x02\xbb\x41\x98\xa6\x2c\xdc\x20\x2c\xd4\xda\xee\x98\x46\x78\xa7\x32\x19\x31\xcb\x95\x84\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xdf\x8f\xe3\xb6\xf1\x7f\xf7\x5f\x31\x38\x3f\x5c\x02\xac\xe5\xe4\xfb\x6d\xd1\xd6\x7d\x28\x1c\xdf\x1d\xea\xee\xdd\xee\x62\xed\x4b\x9a\x47\x5a\x1a\xcb\x8c\x29\x52\x25\xa9\xf5\x39\x45\xff\xf7\x62\x48\xc9\x96\x6d\xfd\xf2\xee\x06\x0d\x12\xf1\xe5\x6e\x2d\x72\x38\xbf\x87\x43\x7d\xa0\x21\x8c\x5e\x6f\x0c\x86\xf0\x91\x87\x28\x0d\x46\x60\x15\xd8\x0d\xc2\x34\x65\xe1\x06\x61\xa1\xd6\x76\xc7\x34\xc2\x07\x95\xc9\x88\x59\xae\x
 [...]
                },
                "/crd/bases/camel.apache.org_integrations.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_integrations.yaml",
diff --git a/pkg/util/maven/maven_types.go b/pkg/util/maven/maven_types.go
index ecf3cc5..e2ea006 100644
--- a/pkg/util/maven/maven_types.go
+++ b/pkg/util/maven/maven_types.go
@@ -31,8 +31,9 @@ type Mirror struct {
 }
 
 type Build struct {
-       DefaultGoal string   `xml:"defaultGoal,omitempty"`
-       Plugins     []Plugin `xml:"plugins>plugin,omitempty"`
+       DefaultGoal string             `xml:"defaultGoal,omitempty"`
+       Plugins     []Plugin           `xml:"plugins>plugin,omitempty"`
+       Extensions  []v1.MavenArtifact `xml:"extensions>extension,omitempty"`
 }
 
 type Plugin struct {

Reply via email to