Skip to content

Commit

Permalink
fix(nx-quarkus): support javaVersion argument override for nx-quarkus…
Browse files Browse the repository at this point in the history
… package

This tries to address a project generator validation error on the `javaVersion` argument. Currently when passing `javaVersion` as an argument you get the error message "Property 'javaVersion' does not match the schema. '17' should be a 'string'.".
  • Loading branch information
Cameron-C-Chapman authored and tinesoft committed Jul 14, 2024
1 parent fc9458b commit dcd4e37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion e2e/nx-quarkus-e2e/tests/nx-quarkus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ describe('nx-quarkus e2e', () => {
const artifactId = 'api';
//const version = '1.2.3'; https://github.com/nrwl/nx/issues/10786
const extensions = 'resteasy';
const javaVersion = '21';

await runNxCommandAsync(
`generate @nxrocks/nx-quarkus:new ${prjName} --projectType ${projectType} --buildSystem=${buildSystem} --groupId=${groupId} --artifactId=${artifactId} --extensions=${extensions} --no-interactive`
`generate @nxrocks/nx-quarkus:new ${prjName} --projectType ${projectType} --buildSystem=${buildSystem} --groupId=${groupId} --artifactId=${artifactId} --extensions=${extensions} --javaVersion ${javaVersion} --no-interactive`
);

const resultBuild = await runNxCommandAsync(`build ${prjName}`);
Expand All @@ -112,6 +113,9 @@ describe('nx-quarkus e2e', () => {
expect(pomXml).toContain(`<groupId>${groupId}</groupId>`);
expect(pomXml).toContain(`<artifactId>${artifactId}</artifactId>`);
//expect(pomXml).toContain(`<version>${version}</version>`);
expect(pomXml).toContain(
`<maven.compiler.releasez>21</maven.compiler.release>`
);

// make sure the build wrapper file is executable (*nix only)
if (!isWin) {
Expand Down
1 change: 1 addition & 0 deletions packages/nx-quarkus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Here the list of available generation options :
| `skipeCodeSamples` | `string` | Whether or not to include code samples from extensions (when available) |
| `tags` | `string` | Tags to use for linting (comma-separated) |
| `directory` | `string` | Directory where the project is placed |
| `javaVersion` | `string \| number` | The java version of the project (currently supports versions 17 and 21) |
> **Note:** If you are working behind a corporate proxy, you can use the `proxyUrl` option to specify the URL of that corporate proxy server.
> Otherwise, you'll get a [ETIMEDOUT error](https://github.com/tinesoft/nxrocks/issues/125) when trying to access official Quarkus Initializer to generate the project.
Expand Down
9 changes: 8 additions & 1 deletion packages/nx-quarkus/src/generators/project/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@
},
"javaVersion": {
"description": "Java version.",
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
}
],
"default": "17",
"enum": ["17", "21"],
"x-prompt": {
Expand Down

0 comments on commit dcd4e37

Please sign in to comment.