From d6fdd938982d9a1abfece9530fbbfe17f670331e Mon Sep 17 00:00:00 2001 From: khalilou88 <32600911+khalilou88@users.noreply.github.com> Date: Sat, 23 Dec 2023 00:42:16 +0100 Subject: [PATCH] fix: use help:evaluate to get project version (#704) * fix: use help:evaluate to get project version * build: work in progress * build: work in progress * build: work in progress * build: work in progress * build: work in progress * build: work in progress * build: work in progress --------- Co-authored-by: khalilou88 --- packages/nx-maven/src/graph/create-nodes.ts | 138 +++++++++++++----- .../tests/nx-maven/all-bom.spec.ts | 18 +-- .../nx-maven/maven-root-directory.spec.ts | 28 ++-- .../tests/nx-maven/micronaut-bom.spec.ts | 12 +- .../nx-maven/micronaut-parent-pom.spec.ts | 40 ++--- .../tests/nx-maven/quarkus-bom.spec.ts | 36 ++--- .../tests/nx-maven/spring-boot-bom.spec.ts | 10 +- .../nx-maven/spring-boot-parent-pom.spec.ts | 50 +++---- 8 files changed, 195 insertions(+), 137 deletions(-) diff --git a/packages/nx-maven/src/graph/create-nodes.ts b/packages/nx-maven/src/graph/create-nodes.ts index 71e2cd1fd..977676cc9 100644 --- a/packages/nx-maven/src/graph/create-nodes.ts +++ b/packages/nx-maven/src/graph/create-nodes.ts @@ -8,7 +8,7 @@ import { import { execSync } from 'child_process'; import { existsSync } from 'fs'; import * as cache from 'memory-cache'; -import { dirname, join } from 'path'; +import * as path from 'path'; import { XmlDocument } from 'xmldoc'; import { getExecutable, getMavenRootDirectory } from '../utils'; @@ -16,12 +16,19 @@ export const createNodes: CreateNodes = [ '**/pom.xml', (pomXmlFilePath: string) => { let projectName; - const projectRoot = dirname(pomXmlFilePath); + const projectRoot = path.dirname(pomXmlFilePath); let targets: { [targetName: string]: TargetConfiguration; } = {}; - const projectJsonPath = join(workspaceRoot, projectRoot, 'project.json'); + const projectPath = path.join(workspaceRoot, projectRoot); + const projectJsonPath = path.join(projectPath, 'project.json'); + + const mavenRootDirectory = getMavenRootDirectory(); + const mavenRootDirAbsolutePath = path.join( + workspaceRoot, + mavenRootDirectory, + ); if (existsSync(projectJsonPath)) { const projectJson = readJsonFile(projectJsonPath); @@ -36,8 +43,15 @@ export const createNodes: CreateNodes = [ const pomXmlContent = readXml(pomXmlFilePath); const artifactId = getArtifactId(pomXmlContent); const groupId = getGroupId(artifactId, pomXmlContent); - const projectVersion = getVersion(artifactId, pomXmlContent); - const localRepositoryLocation = getLocalRepositoryLocation(); + const projectVersion = getVersion( + artifactId, + pomXmlContent, + mavenRootDirAbsolutePath, + projectPath, + ); + const localRepositoryLocation = getLocalRepositoryLocation( + mavenRootDirAbsolutePath, + ); const outputDirLocalRepo = getOutputDirLocalRepo( localRepositoryLocation, @@ -56,8 +70,15 @@ export const createNodes: CreateNodes = [ const pomXmlContent = readXml(pomXmlFilePath); const artifactId = getArtifactId(pomXmlContent); const groupId = getGroupId(artifactId, pomXmlContent); - const projectVersion = getVersion(artifactId, pomXmlContent); - const localRepositoryLocation = getLocalRepositoryLocation(); + const projectVersion = getVersion( + artifactId, + pomXmlContent, + mavenRootDirAbsolutePath, + projectPath, + ); + const localRepositoryLocation = getLocalRepositoryLocation( + mavenRootDirAbsolutePath, + ); const outputDirLocalRepo = getOutputDirLocalRepo( localRepositoryLocation, @@ -117,25 +138,6 @@ function getParentGroupId( return groupIdXml?.val; } -function getParentVersion( - artifactId: string, - pomXmlContent: XmlDocument, -): string { - const parentXml = pomXmlContent.childNamed('parent'); - - if (parentXml === undefined) { - throw new Error(`Parent tag not found for project ${artifactId}`); - } - - const versionXml = parentXml.childNamed('version'); - - if (versionXml === undefined) { - throw new Error(`ParentVersion not found for project ${artifactId}`); - } - - return versionXml?.val; -} - function getGroupId(artifactId: string, pomXmlContent: XmlDocument) { const groupIdXml = pomXmlContent.childNamed('groupId'); if (groupIdXml === undefined) { @@ -152,21 +154,13 @@ function getArtifactId(pomXmlContent: XmlDocument) { return artifactIdXml.val; } -function getVersion(artifactId: string, pomXmlContent: XmlDocument) { - const versionXml = pomXmlContent.childNamed('version'); - if (versionXml === undefined) { - return getParentVersion(artifactId, pomXmlContent); - } - return versionXml.val; -} - function getOutputDirLocalRepo( localRepositoryLocation: string, groupId: string, artifactId: string, projectVersion: string, ) { - return join( + return path.join( localRepositoryLocation, `${groupId.replace( new RegExp(/\./, 'g'), @@ -183,7 +177,7 @@ function getTask(projectRoot: string) { return 'install'; } -function getLocalRepositoryLocation() { +function getLocalRepositoryLocation(mavenRootDirAbsolutePath: string) { const key = 'localRepositoryLocation'; const cachedData = cache.get(key); if (cachedData) { @@ -193,7 +187,11 @@ function getLocalRepositoryLocation() { const regexp = /(.+?)<\/localRepository>/g; const command = `${getExecutable()} help:effective-settings`; - const data = runCommandAndExtractRegExp(command, regexp); + const data = runCommandAndExtractRegExp( + command, + mavenRootDirAbsolutePath, + regexp, + ); // Store data in cache for future use cache.put(key, data, 60000); // Cache for 60 seconds @@ -211,10 +209,13 @@ function isPomPackaging(pomXmlContent: XmlDocument): boolean { return packagingXml.val === 'pom'; } -function runCommandAndExtractRegExp(command: string, regexp: RegExp) { - const mavenRootDirectory = getMavenRootDirectory(); +function runCommandAndExtractRegExp( + command: string, + mavenRootDirAbsolutePath: string, + regexp: RegExp, +) { const objStr = execSync(command, { - cwd: join(workspaceRoot, mavenRootDirectory), + cwd: mavenRootDirAbsolutePath, }).toString(); const matches = (objStr.match(regexp) || []).map((e) => @@ -222,3 +223,60 @@ function runCommandAndExtractRegExp(command: string, regexp: RegExp) { ); return matches[0]; } + +function getVersion( + artifactId: string, + pomXmlContent: XmlDocument, + mavenRootDirAbsolutePath: string, + projectPath: string, +) { + let version; + const versionXml = pomXmlContent.childNamed('version'); + if (versionXml === undefined) { + version = getParentVersion(artifactId, pomXmlContent); + } else { + version = versionXml.val; + } + + if (version.indexOf('${') >= 0) { + version = getEffectiveVersion(mavenRootDirAbsolutePath, projectPath); + } + + return version; +} + +function getParentVersion( + artifactId: string, + pomXmlContent: XmlDocument, +): string { + const parentXml = pomXmlContent.childNamed('parent'); + + if (parentXml === undefined) { + throw new Error(`Parent tag not found for project ${artifactId}`); + } + + const versionXml = parentXml.childNamed('version'); + + if (versionXml === undefined) { + throw new Error(`ParentVersion not found for project ${artifactId}`); + } + + return versionXml?.val; +} + +function getEffectiveVersion( + mavenRootDirAbsolutePath: string, + projectPath: string, +): string { + const pomRelativePath = path.relative(mavenRootDirAbsolutePath, projectPath); + const version = execSync( + `${getExecutable()} -f ${pomRelativePath} help:evaluate -Dexpression=project.version -q -DforceStdout`, + { + cwd: mavenRootDirAbsolutePath, + }, + ) + .toString() + .trim(); + + return version; +} diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/all-bom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/all-bom.spec.ts index 16fb55ccd..de13fbe35 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/all-bom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/all-bom.spec.ts @@ -37,7 +37,7 @@ describe('nx-maven all bom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -52,7 +52,7 @@ describe('nx-maven all bom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -72,7 +72,7 @@ describe('nx-maven all bom e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('1 none app', async () => { const appName = uniq('maven-app-'); @@ -112,7 +112,7 @@ describe('nx-maven all bom e2e', () => { // const lintResult = await runNxCommandAsync(`lint ${appName}`); // expect(lintResult.stdout).toContain('Executor ran for Lint'); - }, 120000); + }, 240000); it('should test an app with none option', async () => { const appName = uniq('maven-app-'); @@ -123,7 +123,7 @@ describe('nx-maven all bom e2e', () => { const testResult = await runNxCommandAsync(`test ${appName}`); expect(testResult.stdout).toContain('Executor ran for Test'); - }, 120000); + }, 240000); it('should serve an app with none option', async () => { const appName = uniq('maven-app-'); @@ -134,7 +134,7 @@ describe('nx-maven all bom e2e', () => { const serveResult = await runNxCommandAsync(`serve ${appName}`); expect(serveResult.stdout).toContain('Executor ran for Serve'); expect(serveResult.stdout).toContain('Hello World!'); - }, 120000); + }, 240000); it('2 none app kt', async () => { const appName = uniq('maven-app-'); @@ -172,7 +172,7 @@ describe('nx-maven all bom e2e', () => { const serveResult = await runNxCommandAsync(`serve ${appName}`); expect(serveResult.stdout).toContain('Executor ran for Serve'); expect(serveResult.stdout).toContain('Hello World!'); - }, 120000); + }, 240000); it('1 none lib', async () => { const libName = uniq('maven-lib-'); @@ -206,7 +206,7 @@ describe('nx-maven all bom e2e', () => { // const lintResult = await runNxCommandAsync(`lint ${libName}`); // expect(lintResult.stdout).toContain('Executor ran for Lint'); - }, 120000); + }, 240000); it('2 none lib kt', async () => { const libName = uniq('maven-lib-'); @@ -238,5 +238,5 @@ describe('nx-maven all bom e2e', () => { // const lintResult = await runNxCommandAsync(`lint ${libName}`); // expect(lintResult.stdout).toContain('Executor ran for Lint'); - }, 120000); + }, 240000); }); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/maven-root-directory.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/maven-root-directory.spec.ts index 9e7553e8e..a14f75752 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/maven-root-directory.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/maven-root-directory.spec.ts @@ -62,7 +62,7 @@ describe('nx-maven maven-root-directory e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -77,7 +77,7 @@ describe('nx-maven maven-root-directory e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -107,7 +107,7 @@ describe('nx-maven maven-root-directory e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('1 none app', async () => { const appName = uniq('maven-app-'); @@ -155,7 +155,7 @@ describe('nx-maven maven-root-directory e2e', () => { updateFile(`nx-maven/${appName}/project.json`, JSON.stringify(projectJson)); const lintResult = await runNxCommandAsync(`lint ${appName}`); expect(lintResult.stdout).toContain('Executor ran for Lint'); - }, 120000); + }, 240000); it('should test an app with none option', async () => { const appName = uniq('maven-app-'); @@ -166,7 +166,7 @@ describe('nx-maven maven-root-directory e2e', () => { const testResult = await runNxCommandAsync(`test ${appName}`); expect(testResult.stdout).toContain('Executor ran for Test'); - }, 120000); + }, 240000); it('should serve an app with none option', async () => { const appName = uniq('maven-app-'); @@ -177,7 +177,7 @@ describe('nx-maven maven-root-directory e2e', () => { const serveResult = await runNxCommandAsync(`serve ${appName}`); expect(serveResult.stdout).toContain('Executor ran for Serve'); expect(serveResult.stdout).toContain('Hello World!'); - }, 120000); + }, 240000); it('2 none app kt', async () => { const appName = uniq('maven-app-'); @@ -227,7 +227,7 @@ describe('nx-maven maven-root-directory e2e', () => { const serveResult = await runNxCommandAsync(`serve ${appName}`); expect(serveResult.stdout).toContain('Executor ran for Serve'); expect(serveResult.stdout).toContain('Hello World!'); - }, 120000); + }, 240000); it('1 none lib', async () => { const libName = uniq('maven-lib-'); @@ -272,7 +272,7 @@ describe('nx-maven maven-root-directory e2e', () => { '{options.outputDirLocalRepo}', ]); expect(projectJson.targets.build.options.outputDirLocalRepo).toBeTruthy(); - }, 120000); + }, 240000); it('2 none lib kt', async () => { const libName = uniq('maven-lib-'); @@ -304,7 +304,7 @@ describe('nx-maven maven-root-directory e2e', () => { // const lintResult = await runNxCommandAsync(`lint ${libName}`); // expect(lintResult.stdout).toContain('Executor ran for Lint'); - }, 120000); + }, 240000); it('should create a java application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -406,7 +406,7 @@ describe('nx-maven maven-root-directory e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should use specified options to create a quarkus application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -579,7 +579,7 @@ describe('nx-maven maven-root-directory e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it('should add a kotlin lib to a kotlin app dependencies', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -744,7 +744,7 @@ describe('nx-maven maven-root-directory e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a micronaut java application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -910,7 +910,7 @@ describe('nx-maven maven-root-directory e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a micronaut kotlin application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -985,5 +985,5 @@ describe('nx-maven maven-root-directory e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); }); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-bom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-bom.spec.ts index 7713fa58a..cc96849f0 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-bom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-bom.spec.ts @@ -46,7 +46,7 @@ describe('nx-maven micronaut bom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -61,7 +61,7 @@ describe('nx-maven micronaut bom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -81,7 +81,7 @@ describe('nx-maven micronaut bom e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('should create a micronaut java application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -235,7 +235,7 @@ describe('nx-maven micronaut bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a micronaut kotlin application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -386,7 +386,7 @@ describe('nx-maven micronaut bom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it('micronaut: should add a kotlin lib to a kotlin app dependencies', async () => { const parentProject = uniq('parent-project-'); @@ -466,5 +466,5 @@ describe('nx-maven micronaut bom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); }); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-parent-pom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-parent-pom.spec.ts index d1a81ec50..9015b268d 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-parent-pom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/micronaut-parent-pom.spec.ts @@ -50,7 +50,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -65,7 +65,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -85,7 +85,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('should create a java application', async () => { const appName = uniq('micronaut-maven-app-'); @@ -204,7 +204,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('should use specified options to create an application', async () => { const randomName = uniq('micronaut-maven-app-'); @@ -381,7 +381,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('--an app with aliases', async () => { const randomName = uniq('micronaut-maven-app-'); @@ -588,7 +588,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a library', async () => { const libName = uniq('micronaut-maven-lib-'); @@ -649,7 +649,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a kotlin library', async () => { const libName = uniq('micronaut-maven-lib-'); @@ -708,7 +708,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should use the the specified properties to create a library', async () => { const randomName = uniq('micronaut-maven-lib-'); @@ -768,7 +768,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generare a lib with a simple package name', async () => { const randomName = uniq('micronaut-maven-lib-'); @@ -828,7 +828,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('--a lib with aliases', async () => { const randomName = uniq('micronaut-maven-lib-'); @@ -888,7 +888,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should add a lib to an app dependencies', async () => { const appName = uniq('micronaut-maven-app-'); @@ -965,7 +965,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it('should add a kotlin lib to a kotlin app dependencies', async () => { const appName = uniq('micronaut-maven-app-'); @@ -1040,7 +1040,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it("should dep-graph don't crash when pom.xml don't contains dependencies tag", async () => { const libName = uniq('micronaut-maven-lib-'); @@ -1068,7 +1068,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generate java apps that use a parent project', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1581,7 +1581,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a minimal java application', async () => { const appName = uniq('micronaut-maven-app-'); @@ -1627,7 +1627,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a minimal kotlin application', async () => { const appName = uniq('micronaut-maven-app-'); @@ -1673,7 +1673,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should skip starter code when generating a java library with skipStarterCode option', async () => { const libName = uniq('micronaut-maven-lib-'); @@ -1695,7 +1695,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { ).className.toLocaleLowerCase()}/HelloServiceTest.java`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should skip starter code when generating a kotlin library with skipStarterCode option', async () => { const libName = uniq('micronaut-maven-lib-'); @@ -1718,7 +1718,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { ).className.toLocaleLowerCase()}/HelloServiceTest.kt`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should generate java app inside a parent project', async () => { const parentProject = uniq('parent-project-'); @@ -1764,7 +1764,7 @@ describe('nx-maven micronaut-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should generate java nested sub-projects', async () => { const appsParentProject = uniq('apps-parent-project-'); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/quarkus-bom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/quarkus-bom.spec.ts index 6967a8552..abc142080 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/quarkus-bom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/quarkus-bom.spec.ts @@ -50,7 +50,7 @@ describe('nx-maven quarkus bom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -65,7 +65,7 @@ describe('nx-maven quarkus bom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -85,7 +85,7 @@ describe('nx-maven quarkus bom e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('should create a java application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -224,7 +224,7 @@ describe('nx-maven quarkus bom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('should use specified options to create an application', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -422,7 +422,7 @@ describe('nx-maven quarkus bom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('--an app with aliases', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -631,7 +631,7 @@ describe('nx-maven quarkus bom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a library', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -698,7 +698,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a kotlin library', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -763,7 +763,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should use the the specified properties to create a library', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -828,7 +828,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generare a lib with a simple package name', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -893,7 +893,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('--a lib with aliases', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -958,7 +958,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should add a lib to an app dependencies', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -1166,7 +1166,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generate java apps that use a parent project', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1683,7 +1683,7 @@ describe('nx-maven quarkus bom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should skip starter code when generating a java application with minimal option', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1719,7 +1719,7 @@ describe('nx-maven quarkus bom e2e', () => { ).className.toLocaleLowerCase()}/GreetingResourceIT.java`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should skip starter code when generating a kotlin application with minimal option', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1755,7 +1755,7 @@ describe('nx-maven quarkus bom e2e', () => { ).className.toLocaleLowerCase()}/GreetingResourceIT.kt`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should skip starter code when generating a java library with skipStarterCode option', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -1788,7 +1788,7 @@ describe('nx-maven quarkus bom e2e', () => { ).className.toLocaleLowerCase()}/GreetingServiceTest.java`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should skip starter code when generating a kotlin library with skipStarterCode option', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -1821,7 +1821,7 @@ describe('nx-maven quarkus bom e2e', () => { ).className.toLocaleLowerCase()}/GreetingServiceTest.kt`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should generate java nested sub-projects', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1915,5 +1915,5 @@ describe('nx-maven quarkus bom e2e', () => { source: thirdAppName, target: thirdParentProject, }); - }, 120000); + }, 240000); }); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-bom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-bom.spec.ts index 4e95409ca..38e1b3fef 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-bom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-bom.spec.ts @@ -57,7 +57,7 @@ describe('nx-maven spring-boot bom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -72,7 +72,7 @@ describe('nx-maven spring-boot bom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -102,7 +102,7 @@ describe('nx-maven spring-boot bom e2e', () => { '{options.outputDirLocalRepo}', ]); expect(projectJson.targets.build.options.outputDirLocalRepo).toBeTruthy(); - }, 120000); + }, 240000); it('spring-boot: should create a java application', async () => { const appName = uniq('boot-maven-app-'); @@ -286,7 +286,7 @@ describe('nx-maven spring-boot bom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it('spring-boot: should add a kotlin lib to a kotlin app dependencies', async () => { const appName = uniq('boot-maven-app-'); @@ -457,5 +457,5 @@ describe('nx-maven spring-boot bom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); }); diff --git a/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-parent-pom.spec.ts b/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-parent-pom.spec.ts index 7c0f0bbdf..26c5bd069 100644 --- a/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-parent-pom.spec.ts +++ b/testing-projects/jnxplus-e2e/tests/nx-maven/spring-boot-parent-pom.spec.ts @@ -50,7 +50,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { if (isCI) { removeTmpFromGitignore(); } - }, 120000); + }, 240000); afterAll(async () => { if (isCI) { @@ -65,7 +65,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { it('should set NX_VERBOSE_LOGGING to true', async () => { expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); - }, 120000); + }, 240000); it('should init the workspace with @jnxplus/nx-maven capabilities', async () => { // Making sure the package.json file contains the @jnxplus/nx-maven dependency @@ -85,7 +85,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { 'pom.xml', ), ).not.toThrow(); - }, 120000); + }, 240000); it('should create a java application', async () => { const appName = uniq('boot-maven-app-'); @@ -204,7 +204,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('should use specified options to create an application', async () => { const randomName = uniq('boot-maven-app-'); @@ -389,7 +389,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { ); expect(buildImageResult.stdout).toContain('Executor ran for Build Image'); } - }, 120000); + }, 240000); it('--an app with aliases', async () => { const randomName = uniq('boot-maven-app-'); @@ -477,7 +477,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: appName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generate an app with a simple package name', async () => { const randomName = uniq('boot-maven-app-'); @@ -565,7 +565,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('directory with dash', async () => { const randomName = uniq('boot-maven-app-'); @@ -605,7 +605,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a library', async () => { const libName = uniq('boot-maven-lib-'); @@ -669,7 +669,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a kotlin library', async () => { const libName = uniq('boot-maven-lib-'); @@ -731,7 +731,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should use the the specified properties to create a library', async () => { const randomName = uniq('boot-maven-lib-'); @@ -793,7 +793,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generare a lib with a simple package name', async () => { const randomName = uniq('boot-maven-lib-'); @@ -855,7 +855,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('--a lib with aliases', async () => { const randomName = uniq('boot-maven-lib-'); @@ -917,7 +917,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should add a lib to an app dependencies', async () => { const port = 9090; @@ -1011,7 +1011,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: appName, target: libName, }); - }, 120000); + }, 240000); it('should test an app with a lib', async () => { const appName = uniq('boot-maven-app-'); @@ -1056,7 +1056,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { const testResult2 = await runNxCommandAsync(`test ${libName}`); expect(testResult2.stdout).toContain('Executor ran for Test'); - }, 120000); + }, 240000); it('should add a kotlin lib to a kotlin app dependencies', async () => { const appName = uniq('boot-maven-app-'); @@ -1167,7 +1167,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should generate java apps that use a parent project', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -1443,7 +1443,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: thirdLibName, target: thirdParentProject, }); - }, 120000); + }, 240000); it('should generate kotlin libs that use a parent project', async () => { const libsParentProject = uniq('libs-parent-project-'); @@ -1624,7 +1624,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a library with a simple name', async () => { const libName = uniq('boot-maven-lib-'); @@ -1685,7 +1685,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { source: libName, target: parentProjectName, }); - }, 120000); + }, 240000); it('should create a minimal java application', async () => { const appName = uniq('boot-maven-app-'); @@ -1735,7 +1735,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should create a minimal kotlin application', async () => { const appName = uniq('boot-maven-app-'); @@ -1789,7 +1789,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should skip starter code when generating a java library with skipStarterCode option', async () => { const libName = uniq('boot-maven-lib-'); @@ -1813,7 +1813,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { ).className.toLocaleLowerCase()}/HelloServiceTests.java`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should skip starter code when generating a kotlin library with skipStarterCode option', async () => { const libName = uniq('boot-maven-lib-'); @@ -1838,7 +1838,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { ).className.toLocaleLowerCase()}/HelloServiceTests.kt`, ), ).not.toThrow(); - }, 120000); + }, 240000); it('should generate java app inside a parent project', async () => { const parentProject = uniq('parent-project-'); @@ -1884,7 +1884,7 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { } catch (err) { // ignore err } - }, 120000); + }, 240000); it('should generate java nested sub-projects', async () => { const appsParentProject = uniq('apps-parent-project-'); @@ -2000,5 +2000,5 @@ describe('nx-maven spring-boot-parent-pom e2e', () => { expect(depGraphResult.stderr).not.toContain( 'Failed to process the project graph', ); - }, 120000); + }, 240000); });