@nx/maven 23.2.0-beta.7 → 23.2.0-beta.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"maven-analyzer.d.ts","sourceRoot":"","sources":["../../src/plugins/maven-analyzer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAShE;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAKjD;AAaD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA6J5B"}
1
+ {"version":3,"file":"maven-analyzer.d.ts","sourceRoot":"","sources":["../../src/plugins/maven-analyzer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAahE;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAKjD;AAaD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA8J5B"}
@@ -2,13 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cancelPendingMavenAnalysis = cancelPendingMavenAnalysis;
4
4
  exports.runMavenAnalysis = runMavenAnalysis;
5
- const tslib_1 = require("tslib");
6
5
  const path_1 = require("path");
7
6
  const fs_1 = require("fs");
8
- const child_process_1 = require("child_process");
9
7
  const devkit_1 = require("@nx/devkit");
10
8
  const detect_maven_executable_1 = require("../utils/detect-maven-executable");
11
- const tree_kill_1 = tslib_1.__importDefault(require("tree-kill"));
12
9
  const internal_1 = require("@nx/devkit/internal");
13
10
  const DEFAULT_ANALYSIS_TIMEOUT_SECONDS = (0, internal_1.isCI)() ? 600 : 120;
14
11
  let currentAbortController;
@@ -77,17 +74,18 @@ async function runMavenAnalysis(workspaceRoot, options) {
77
74
  devkit_1.logger.verbose(`[Maven Analyzer] Spawning Maven process...`);
78
75
  try {
79
76
  await new Promise((resolve, reject) => {
80
- const child = (0, child_process_1.spawn)(mavenExecutable, mavenArgs, {
77
+ const child = (0, internal_1.safeSpawn)(mavenExecutable, mavenArgs, {
81
78
  cwd: workspaceRoot,
82
- windowsHide: true,
83
- shell: true,
84
79
  stdio: 'pipe', // Always use pipe so we can control output
85
80
  });
86
- // Use tree-kill on abort to kill the entire process tree
81
+ // On abort, kill the entire process tree and settle immediately — a
82
+ // wedged process that outlives the kill signal would otherwise keep
83
+ // this promise pending and the abort error would never surface.
87
84
  const onAbort = () => {
88
85
  if (child.pid) {
89
- (0, tree_kill_1.default)(child.pid);
86
+ (0, internal_1.killProcessTreeGraceful)(child.pid).catch(() => { });
90
87
  }
88
+ reject(new Error('Maven analysis aborted'));
91
89
  };
92
90
  signal.addEventListener('abort', onAbort, { once: true });
93
91
  devkit_1.logger.verbose(`[Maven Analyzer] Process spawned with PID: ${child.pid}`);
@@ -1 +1 @@
1
- {"version":3,"file":"detect-maven-executable.d.ts","sourceRoot":"","sources":["../../src/utils/detect-maven-executable.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBvE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA4BnE"}
1
+ {"version":3,"file":"detect-maven-executable.d.ts","sourceRoot":"","sources":["../../src/utils/detect-maven-executable.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqBvE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA4BnE"}
@@ -4,10 +4,9 @@ exports.detectMavenVersion = detectMavenVersion;
4
4
  exports.isMaven4 = isMaven4;
5
5
  exports.detectMavenExecutable = detectMavenExecutable;
6
6
  const fs_1 = require("fs");
7
- const child_process_1 = require("child_process");
8
7
  const path_1 = require("path");
9
8
  const devkit_1 = require("@nx/devkit");
10
- // Cache Maven version to avoid repeated execSync calls
9
+ const internal_1 = require("@nx/devkit/internal");
11
10
  let cachedMavenVersion = null;
12
11
  /**
13
12
  * Detect Maven version (e.g., "4.0.0-rc-4" or "3.9.9")
@@ -18,11 +17,8 @@ function detectMavenVersion(workspaceRoot) {
18
17
  }
19
18
  const executable = detectMavenExecutable(workspaceRoot);
20
19
  try {
21
- const output = (0, child_process_1.execSync)(`${executable} --version`, {
20
+ const output = (0, internal_1.safeExecFileSync)(executable, ['--version'], {
22
21
  cwd: workspaceRoot,
23
- stdio: 'pipe',
24
- encoding: 'utf-8',
25
- windowsHide: true,
26
22
  });
27
23
  // Parse version from output like "Apache Maven 4.0.0-rc-4" or "Apache Maven 3.9.9"
28
24
  const match = output.match(/Apache Maven (\d+\.\d+\.\d+[^\s]*)/);
@@ -50,7 +46,7 @@ function isMaven4(workspaceRoot) {
50
46
  function detectMavenExecutable(workspaceRoot) {
51
47
  // First priority: Check for Maven Daemon
52
48
  try {
53
- (0, child_process_1.execSync)('mvnd --version', { stdio: 'pipe', windowsHide: true });
49
+ (0, internal_1.safeExecFileSync)('mvnd', ['--version']);
54
50
  devkit_1.logger.verbose(`[Maven] Found Maven Daemon, using: mvnd`);
55
51
  return 'mvnd';
56
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/maven",
3
- "version": "23.2.0-beta.7",
3
+ "version": "23.2.0-beta.8",
4
4
  "private": false,
5
5
  "description": "Nx plugin for Maven integration",
6
6
  "repository": {
@@ -50,9 +50,8 @@
50
50
  "license": "MIT",
51
51
  "dependencies": {
52
52
  "@xmldom/xmldom": "^0.8.10",
53
- "tree-kill": "^1.2.2",
54
53
  "tslib": "^2.3.0",
55
- "@nx/devkit": "23.2.0-beta.7"
54
+ "@nx/devkit": "23.2.0-beta.8"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@types/jest": "30.0.0",
@@ -62,7 +61,7 @@
62
61
  "memfs": "^4.9.2",
63
62
  "ts-jest": "^29.4.7",
64
63
  "typescript": "~6.0.3",
65
- "nx": "23.2.0-beta.7"
64
+ "nx": "23.2.0-beta.8"
66
65
  },
67
66
  "publishConfig": {
68
67
  "access": "public"