@nx/maven 23.0.0-beta.2 → 23.0.0-beta.20

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.
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"maven-batch.impl.d.ts","sourceRoot":"","sources":["../../../src/executors/maven/maven-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AAKvE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAyE/C;;;GAGG;AACH,wBAA+B,kBAAkB,CAC/C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC3C,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAuHtD"}
1
+ {"version":3,"file":"maven-batch.impl.d.ts","sourceRoot":"","sources":["../../../src/executors/maven/maven-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AAKvE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAyE/C;;;GAGG;AACH,wBAA+B,kBAAkB,CAC/C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC3C,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAmItD"}
@@ -108,64 +108,72 @@ async function* mavenBatchExecutor(taskGraph, inputs, overrides, context) {
108
108
  const stderrLines = [];
109
109
  // Collect terminal output from failed tasks
110
110
  const failedTaskOutputs = [];
111
- // Yield results as they stream in
112
- for await (const line of rl) {
113
- if (line.startsWith('NX_RESULT:')) {
114
- try {
115
- const jsonStr = line.slice('NX_RESULT:'.length);
116
- const data = JSON.parse(jsonStr);
117
- const result = {
118
- success: data.result.success ?? false,
119
- terminalOutput: data.result.terminalOutput ?? '',
120
- startTime: data.result.startTime,
121
- endTime: data.result.endTime,
122
- };
123
- // Collect terminal output from failed tasks
124
- if (!result.success && result.terminalOutput) {
125
- failedTaskOutputs.push(result.terminalOutput);
111
+ const taskIds = Object.keys(taskGraph.tasks);
112
+ const yielded = new Set();
113
+ try {
114
+ for await (const line of rl) {
115
+ if (line.startsWith('NX_RESULT:')) {
116
+ try {
117
+ const data = JSON.parse(line.slice('NX_RESULT:'.length));
118
+ const result = {
119
+ success: data.result.success ?? false,
120
+ status: data.result.status,
121
+ terminalOutput: data.result.terminalOutput ?? '',
122
+ startTime: data.result.startTime,
123
+ endTime: data.result.endTime,
124
+ };
125
+ if (!result.success && result.terminalOutput) {
126
+ failedTaskOutputs.push(result.terminalOutput);
127
+ }
128
+ yielded.add(data.task);
129
+ yield { task: data.task, result };
130
+ }
131
+ catch (e) {
132
+ console.error('[Maven Batch] Failed to parse result line:', line, e);
126
133
  }
127
- yield {
128
- task: data.task,
129
- result,
130
- };
131
134
  }
132
- catch (e) {
133
- console.error('[Maven Batch] Failed to parse result line:', line, e);
135
+ else if (line.trim()) {
136
+ stderrLines.push(line);
134
137
  }
135
138
  }
136
- else if (line.trim()) {
137
- // Collect non-empty stderr lines for error reporting
138
- stderrLines.push(line);
139
- }
140
- }
141
- // Wait for process to exit
142
- await new Promise((resolve, reject) => {
143
- child.on('close', (code) => {
144
- if (process.env.NX_VERBOSE_LOGGING === 'true') {
145
- console.log(`[Maven Batch] Process exited with code: ${code}`);
146
- }
147
- // If process exited unexpectedly, print captured stderr
148
- if (code !== 0 && stderrLines.length > 0) {
149
- console.error(`[Maven Batch] Process exited with code ${code}. Stderr output:`);
139
+ const exitCode = await new Promise((resolvePromise, rejectPromise) => {
140
+ child.on('close', (code) => {
141
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
142
+ console.log(`[Maven Batch] Process exited with code: ${code}`);
143
+ }
144
+ resolvePromise(code ?? 0);
145
+ });
146
+ child.on('error', rejectPromise);
147
+ });
148
+ if (exitCode !== 0) {
149
+ if (stderrLines.length > 0) {
150
+ console.error(`[Maven Batch] Process exited with code ${exitCode}. Stderr output:`);
150
151
  for (const line of stderrLines) {
151
152
  console.error(line);
152
153
  }
153
154
  }
154
- // Print failed task outputs to stderr so they appear in error.message
155
155
  if (failedTaskOutputs.length > 0) {
156
156
  console.error('\n[Maven Batch] Failed task outputs:');
157
157
  for (const output of failedTaskOutputs) {
158
158
  console.error(output);
159
159
  }
160
160
  }
161
- // Reject promise if batch runner exited with non-zero code
162
- if (code !== 0) {
163
- reject(new Error(`Maven batch runner exited with code ${code}`));
164
- }
165
- else {
166
- resolve();
161
+ throw new Error(`Maven batch runner exited with code ${exitCode}`);
162
+ }
163
+ }
164
+ catch (e) {
165
+ // Runner crashed before reporting on every task — backfill so Nx doesn't hang.
166
+ for (const taskId of taskIds) {
167
+ if (!yielded.has(taskId)) {
168
+ yielded.add(taskId);
169
+ yield {
170
+ task: taskId,
171
+ result: {
172
+ success: false,
173
+ terminalOutput: e.toString(),
174
+ },
175
+ };
167
176
  }
168
- });
169
- child.on('error', reject);
170
- });
177
+ }
178
+ }
171
179
  }
Binary file
@@ -17,7 +17,7 @@ function readMavenCache(cachePath) {
17
17
  * Write the Maven targets cache to disk
18
18
  */
19
19
  function writeMavenCache(cachePath, cache) {
20
- cache.writeToDisk(cachePath);
20
+ cache.writeToDisk();
21
21
  }
22
22
  /**
23
23
  * Get the cache path for a given options hash
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/plugins/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,aAAa,EAAa,MAAM,YAAY,CAAC;AAE3E,OAAO,EAAmB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAW9D;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,kBAAkB,CA+EzD,CAAC"}
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/plugins/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,aAAa,EAAa,MAAM,YAAY,CAAC;AAG3E,OAAO,EAAmB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAU9D;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,kBAAkB,CA+EzD,CAAC"}
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodes = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const path_1 = require("path");
6
7
  const types_1 = require("./types");
7
8
  const maven_analyzer_1 = require("./maven-analyzer");
8
9
  const maven_data_cache_1 = require("./maven-data-cache");
9
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
10
10
  const devkit_internals_1 = require("nx/src/devkit-internals");
11
11
  /**
12
12
  * Maven plugin that analyzes Maven projects and returns configurations
@@ -34,7 +34,7 @@ exports.createNodes = [
34
34
  const mavenCache = (0, maven_data_cache_1.readMavenCache)(cachePath);
35
35
  // Calculate hashes for all pom.xml directories
36
36
  const projectRoots = configFiles.map((file) => (0, path_1.dirname)(file));
37
- const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, opts, context);
37
+ const hashes = await (0, internal_1.calculateHashesForCreateNodes)(projectRoots, opts, context);
38
38
  // Combine all hashes into a single hash for the cache key
39
39
  const hash = (0, devkit_1.hashArray)(hashes);
40
40
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/maven",
3
- "version": "23.0.0-beta.2",
3
+ "version": "23.0.0-beta.20",
4
4
  "private": false,
5
5
  "description": "Nx plugin for Maven integration",
6
6
  "repository": {
@@ -47,18 +47,18 @@
47
47
  "author": "Victor Savkin",
48
48
  "license": "MIT",
49
49
  "dependencies": {
50
- "@nx/devkit": "23.0.0-beta.2",
50
+ "@nx/devkit": "23.0.0-beta.20",
51
51
  "@xmldom/xmldom": "^0.8.10",
52
52
  "tree-kill": "^1.2.2",
53
53
  "tslib": "^2.3.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/jest": "30.0.0",
57
- "@types/node": "^20.19.10",
57
+ "@types/node": "^24.11.0",
58
58
  "@types/xmldom": "^0.1.34",
59
- "jest": "^30.0.2",
59
+ "jest": "30.3.0",
60
60
  "memfs": "^4.9.2",
61
- "nx": "23.0.0-beta.2",
61
+ "nx": "23.0.0-beta.20",
62
62
  "ts-jest": "^29.4.0",
63
63
  "typescript": "~5.9.2"
64
64
  },