This is an automated email from the ASF dual-hosted git repository.
ricardozanini pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new b9ee5e43319 incubator-kie-issues#1334: kn workflow create should
preserve the ind… (#2531)
b9ee5e43319 is described below
commit b9ee5e43319aedfb1108346b9402ee96b725d4ab
Author: Dmitrii Tikhomirov <[email protected]>
AuthorDate: Tue Aug 20 04:37:05 2024 -0700
incubator-kie-issues#1334: kn workflow create should preserve the ind…
(#2531)
---
.../e2e-tests/quarkus_convert_test.go | 7 -------
.../e2e-tests/quarkus_create_test.go | 7 -------
.../kn-plugin-workflow/pkg/command/quarkus/create.go | 6 +++++-
.../pkg/command/quarkus/quarkus_project.go | 18 +++++++++++++++++-
4 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go
b/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go
index e8d7726c904..8fd60a5b6ca 100644
--- a/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go
@@ -118,8 +118,6 @@ func RunQuarkusConvertTest(t *testing.T,
cfgTestInputCreateConvert CfgTestInputC
"src/main/docker",
"src/main",
"src",
- ".mvn/wrapper",
- ".mvn",
}
VerifyDirectoriesExist(t, projectDir, expectedDirectories)
expectedFiles := []string{
@@ -129,15 +127,10 @@ func RunQuarkusConvertTest(t *testing.T,
cfgTestInputCreateConvert CfgTestInputC
"src/main/docker/Dockerfile.jvm",
"src/main/docker/Dockerfile.native",
"src/main/docker/Dockerfile.native-micro",
- ".mvn/wrapper/.gitignore",
- ".mvn/wrapper/MavenWrapperDownloader.java",
- ".mvn/wrapper/maven-wrapper.properties",
".gitignore",
"pom.xml",
"README.md",
".dockerignore",
- "mvnw.cmd",
- "mvnw",
}
VerifyFilesExist(t, projectDir, expectedFiles)
diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
index 200f50d808c..5284e76fcae 100644
--- a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
@@ -120,8 +120,6 @@ func RunQuarkusCreateTest(t *testing.T, test
CfgTestInputQuarkusCreate) string {
"src/main/docker",
"src/main",
"src",
- ".mvn/wrapper",
- ".mvn",
}
VerifyDirectoriesExist(t, projectDir, expectedDirectories)
expectedFiles := []string{
@@ -131,15 +129,10 @@ func RunQuarkusCreateTest(t *testing.T, test
CfgTestInputQuarkusCreate) string {
"src/main/docker/Dockerfile.jvm",
"src/main/docker/Dockerfile.native",
"src/main/docker/Dockerfile.native-micro",
- ".mvn/wrapper/.gitignore",
- ".mvn/wrapper/MavenWrapperDownloader.java",
- ".mvn/wrapper/maven-wrapper.properties",
".gitignore",
"pom.xml",
"README.md",
".dockerignore",
- "mvnw.cmd",
- "mvnw",
}
VerifyFilesExist(t, projectDir, expectedFiles)
diff --git a/packages/kn-plugin-workflow/pkg/command/quarkus/create.go
b/packages/kn-plugin-workflow/pkg/command/quarkus/create.go
index d16a1d051c7..e43e03e1813 100644
--- a/packages/kn-plugin-workflow/pkg/command/quarkus/create.go
+++ b/packages/kn-plugin-workflow/pkg/command/quarkus/create.go
@@ -114,7 +114,6 @@ func runCreateProject(cfg CreateQuarkusProjectConfig) (err
error) {
"mvn",
fmt.Sprintf("%s:%s:%s:create",
cfg.DependenciesVersion.QuarkusPlatformGroupId, metadata.QuarkusMavenPlugin,
cfg.DependenciesVersion.QuarkusVersion),
"-DprojectGroupId=org.acme",
- "-DnoCode",
fmt.Sprintf("-DplatformVersion=%s",
cfg.DependenciesVersion.QuarkusVersion),
fmt.Sprintf("-DprojectArtifactId=%s", cfg.ProjectName),
fmt.Sprintf("-Dextensions=%s", cfg.Extensions))
@@ -127,6 +126,11 @@ func runCreateProject(cfg CreateQuarkusProjectConfig) (err
error) {
); err != nil {
return err
}
+
+ if err := PostMavenCleanup(cfg); err != nil {
+ return err
+ }
+
return
}
diff --git a/packages/kn-plugin-workflow/pkg/command/quarkus/quarkus_project.go
b/packages/kn-plugin-workflow/pkg/command/quarkus/quarkus_project.go
index 7befb9aa0a9..6d3bf133e51 100644
--- a/packages/kn-plugin-workflow/pkg/command/quarkus/quarkus_project.go
+++ b/packages/kn-plugin-workflow/pkg/command/quarkus/quarkus_project.go
@@ -21,6 +21,7 @@ package quarkus
import (
"fmt"
+ "os"
"github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/common"
"github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/metadata"
@@ -39,6 +40,8 @@ type Repository struct {
Url string
}
+var filesToRemove = []string{"mvnw", "mvnw.cmd", ".mvn"}
+
func CreateQuarkusProject(cfg CreateQuarkusProjectConfig) error {
if err := common.CheckProjectName(cfg.ProjectName); err != nil {
return err
@@ -51,7 +54,6 @@ func CreateQuarkusProject(cfg CreateQuarkusProjectConfig)
error {
"mvn",
fmt.Sprintf("%s:%s:%s:create",
cfg.DependenciesVersion.QuarkusPlatformGroupId, metadata.QuarkusMavenPlugin,
cfg.DependenciesVersion.QuarkusVersion),
"-DprojectGroupId=org.acme",
- "-DnoCode",
fmt.Sprintf("-DprojectArtifactId=%s", cfg.ProjectName),
fmt.Sprintf("-Dextensions=%s", cfg.Extensions))
@@ -62,6 +64,10 @@ func CreateQuarkusProject(cfg CreateQuarkusProjectConfig)
error {
return err
}
+ if err := PostMavenCleanup(cfg); err != nil {
+ return err
+ }
+
//Until we are part of Quarkus 3.x bom we need to manipulate the
pom.xml to use the right kogito dependencies
pomPath := cfg.ProjectName + "/pom.xml"
if err := manipulatePomToKogito(pomPath, cfg); err != nil {
@@ -70,6 +76,16 @@ func CreateQuarkusProject(cfg CreateQuarkusProjectConfig)
error {
return nil
}
+func PostMavenCleanup(cfg CreateQuarkusProjectConfig) error {
+ for _, file := range filesToRemove {
+ var fqdn = cfg.ProjectName + "/" + file
+ if err := os.RemoveAll(fqdn); err != nil {
+ return fmt.Errorf("error removing %s: %w", fqdn, err)
+ }
+ }
+ return nil
+}
+
func manipulatePomToKogito(filename string, cfg CreateQuarkusProjectConfig)
error {
if cfg.DependenciesVersion.QuarkusPlatformGroupId == "" ||
cfg.DependenciesVersion.QuarkusVersion == "" {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]