@nx/maven 22.1.0-beta.5 → 22.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ nx: nrwl/nx@1.7.0
5
+
6
+ env:
7
+ NX_BATCH_MODE: true
8
+
9
+ jobs:
10
+ main:
11
+ environment:
12
+ # Configure the JVM to avoid OOM errors
13
+ _JAVA_OPTIONS: "-Xmx3g"
14
+ MAVEN_OPTS: "-Xmx3g"
15
+ docker:
16
+ - image: cimg/openjdk:21.0-node
17
+ steps:
18
+ - checkout
19
+
20
+ # This enables task distribution via Nx Cloud
21
+ # Run this command as early as possible, before dependencies are installed
22
+ # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
23
+ <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
24
+ # - run: ./nx start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="verify-ci"
25
+
26
+ - nx/set-shas:
27
+ main-branch-name: '<%= mainBranch %>'
28
+ <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
29
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
30
+ - run:
31
+ command: <%= command.command %><% if (command.alwaysRun) { %>
32
+ when: always<% } %><% } %><% } %>
33
+
34
+ workflows:
35
+ version: 2
36
+
37
+ <%= workflowFileName %>:
38
+ jobs:
39
+ - main
@@ -0,0 +1,42 @@
1
+ name: <%= workflowName %>
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - <%= mainBranch %>
7
+ pull_request:
8
+
9
+ permissions:
10
+ actions: read
11
+ contents: read
12
+
13
+ env:
14
+ NX_BATCH_MODE: true
15
+
16
+ jobs:
17
+ main:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+ filter: tree:0
24
+
25
+ # This enables task distribution via Nx Cloud
26
+ # Run this command as early as possible, before dependencies are installed
27
+ # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
28
+ <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
29
+ # - run: ./nx start-ci-run --distribute-on="3 linux-medium-jvm" --stop-agents-after="verify-ci"
30
+
31
+ - name: Set up JDK 21 for x64
32
+ uses: actions/setup-java@v4
33
+ with:
34
+ java-version: '21'
35
+ distribution: 'temurin'
36
+ architecture: x64
37
+
38
+ - uses: nrwl/nx-set-shas@v4
39
+ <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
40
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
41
+ - run: <%= command.command %><% if (command.alwaysRun) { %>
42
+ if: always()<% } %><% } %><% } %>
@@ -0,0 +1,15 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export type Command = {
3
+ command?: string;
4
+ comments?: string[];
5
+ alwaysRun?: boolean;
6
+ };
7
+ export interface Schema {
8
+ name: string;
9
+ ci: 'github' | 'circleci';
10
+ packageManager?: null;
11
+ commands?: Command[];
12
+ }
13
+ export declare function ciWorkflowGenerator(tree: Tree, schema: Schema): Promise<void>;
14
+ export default ciWorkflowGenerator;
15
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/ci-workflow/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AA4CpB,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC1B,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAMnE;AAsCD,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ciWorkflowGenerator = ciWorkflowGenerator;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path_1 = require("path");
6
+ const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
7
+ const default_base_1 = require("nx/src/utils/default-base");
8
+ function getCiCommands(ci) {
9
+ switch (ci) {
10
+ case 'circleci': {
11
+ return [
12
+ {
13
+ comments: [
14
+ `# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
15
+ ],
16
+ },
17
+ {
18
+ command: `./nx affected --base=$NX_BASE --head=$NX_HEAD -t verify-ci`,
19
+ },
20
+ getNxCloudFixCiCommand(),
21
+ ];
22
+ }
23
+ default: {
24
+ return [
25
+ {
26
+ comments: [
27
+ `Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected.`,
28
+ ],
29
+ command: `./nx affected -t verify-ci`,
30
+ },
31
+ getNxCloudFixCiCommand(),
32
+ ];
33
+ }
34
+ }
35
+ }
36
+ function getNxCloudFixCiCommand() {
37
+ return {
38
+ comments: [
39
+ `Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci`,
40
+ ],
41
+ command: `./nx fix-ci`,
42
+ alwaysRun: true,
43
+ };
44
+ }
45
+ async function ciWorkflowGenerator(tree, schema) {
46
+ const ci = schema.ci;
47
+ const options = getTemplateData(tree, schema);
48
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', ci), '', options);
49
+ await (0, devkit_1.formatFiles)(tree);
50
+ }
51
+ function getTemplateData(tree, options) {
52
+ const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
53
+ let nxCloudHost = 'nx.app';
54
+ try {
55
+ const nxCloudUrl = (0, nx_cloud_utils_1.getNxCloudUrl)((0, devkit_1.readNxJson)(tree));
56
+ nxCloudHost = new URL(nxCloudUrl).host;
57
+ }
58
+ catch { }
59
+ const mainBranch = (0, default_base_1.deduceDefaultBase)();
60
+ const commands = options.commands ?? getCiCommands(options.ci);
61
+ const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readNxJson)(tree));
62
+ return {
63
+ workflowName,
64
+ workflowFileName,
65
+ commands,
66
+ mainBranch,
67
+ nxCloudHost,
68
+ connectedToCloud,
69
+ };
70
+ }
71
+ exports.default = ciWorkflowGenerator;
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "NxMavenCiWorkflowSchema",
4
+ "title": "Maven CI Workflow Generator",
5
+ "description": "Setup a CI Workflow to run Nx in CI.",
6
+ "type": "object",
7
+ "properties": {
8
+ "ci": {
9
+ "type": "string",
10
+ "description": "CI provider.",
11
+ "enum": ["github", "circleci"],
12
+ "x-prompt": {
13
+ "message": "What is your target CI provider?",
14
+ "type": "list",
15
+ "items": [
16
+ {
17
+ "value": "github",
18
+ "label": "GitHub Actions"
19
+ },
20
+ {
21
+ "value": "circleci",
22
+ "label": "Circle CI"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ "name": {
28
+ "type": "string",
29
+ "description": "Workflow name.",
30
+ "$default": {
31
+ "$source": "argv",
32
+ "index": 0
33
+ },
34
+ "default": "CI",
35
+ "x-prompt": "How should we name your workflow?",
36
+ "pattern": "^[a-zA-Z].*$"
37
+ }
38
+ },
39
+ "required": ["ci", "name"]
40
+ }
@@ -5,6 +5,11 @@
5
5
  "implementation": "./dist/generators/init/generator",
6
6
  "schema": "./dist/generators/init/schema.json",
7
7
  "description": "Initialize Maven support in an Nx workspace"
8
+ },
9
+ "ci-workflow": {
10
+ "implementation": "./dist/generators/ci-workflow/generator",
11
+ "schema": "./dist/generators/ci-workflow/schema.json",
12
+ "description": "Setup a CI Workflow to run Nx in CI"
8
13
  }
9
14
  }
10
15
  }
@@ -0,0 +1,7 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Migration for @nx/maven v0.0.9
4
+ * Updates the Maven plugin version from 0.0.8 to 0.0.9 in user pom.xml files
5
+ */
6
+ export default function update(tree: Tree): Promise<void>;
7
+ //# sourceMappingURL=update-pom-xml-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-pom-xml-version.d.ts","sourceRoot":"","sources":["../../../src/migrations/0-0-9/update-pom-xml-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC;;;GAGG;AACH,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAE9C"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const pom_xml_updater_1 = require("../../utils/pom-xml-updater");
5
+ /**
6
+ * Migration for @nx/maven v0.0.9
7
+ * Updates the Maven plugin version from 0.0.8 to 0.0.9 in user pom.xml files
8
+ */
9
+ async function update(tree) {
10
+ (0, pom_xml_updater_1.updateNxMavenPluginVersion)(tree, '0.0.9');
11
+ }
@@ -1,3 +1,3 @@
1
1
  export declare const nxVersion: any;
2
- export declare const mavenPluginVersion = "0.0.8";
2
+ export declare const mavenPluginVersion = "0.0.9";
3
3
  //# sourceMappingURL=versions.d.ts.map
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mavenPluginVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.mavenPluginVersion = '0.0.8';
5
+ exports.mavenPluginVersion = '0.0.9';
package/generators.json CHANGED
@@ -5,6 +5,11 @@
5
5
  "implementation": "./dist/generators/init/generator",
6
6
  "schema": "./dist/generators/init/schema.json",
7
7
  "description": "Initialize Maven support in an Nx workspace"
8
+ },
9
+ "ci-workflow": {
10
+ "implementation": "./dist/generators/ci-workflow/generator",
11
+ "schema": "./dist/generators/ci-workflow/schema.json",
12
+ "description": "Setup a CI Workflow to run Nx in CI"
8
13
  }
9
14
  }
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/maven",
3
- "version": "22.1.0-beta.5",
3
+ "version": "22.1.0-beta.7",
4
4
  "private": false,
5
5
  "description": "Nx plugin for Maven integration",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "author": "Victor Savkin",
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@nx/devkit": "22.1.0-beta.5",
48
+ "@nx/devkit": "22.1.0-beta.7",
49
49
  "@xmldom/xmldom": "^0.8.10",
50
50
  "tslib": "^2.3.0"
51
51
  },
@@ -55,7 +55,7 @@
55
55
  "@types/xmldom": "^0.1.34",
56
56
  "jest": "^30.0.2",
57
57
  "memfs": "^4.9.2",
58
- "nx": "22.1.0-beta.5",
58
+ "nx": "22.1.0-beta.7",
59
59
  "ts-jest": "^29.4.0",
60
60
  "typescript": "~5.9.2"
61
61
  },