@nx/maven 22.7.1 → 22.7.2

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/maven",
3
- "version": "22.7.1",
3
+ "version": "22.7.2",
4
4
  "private": false,
5
5
  "description": "Nx plugin for Maven integration",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "author": "Victor Savkin",
48
48
  "license": "MIT",
49
49
  "dependencies": {
50
- "@nx/devkit": "22.7.1",
50
+ "@nx/devkit": "22.7.2",
51
51
  "@xmldom/xmldom": "^0.8.10",
52
52
  "tree-kill": "^1.2.2",
53
53
  "tslib": "^2.3.0"
@@ -56,9 +56,9 @@
56
56
  "@types/jest": "30.0.0",
57
57
  "@types/node": "^20.19.10",
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": "22.7.1",
61
+ "nx": "22.7.2",
62
62
  "ts-jest": "^29.4.0",
63
63
  "typescript": "~5.9.2"
64
64
  },