@nx/maven 22.5.0 → 22.5.1
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.
- package/dist/executors/maven/maven-batch.impl.d.ts.map +1 -1
- package/dist/executors/maven/maven-batch.impl.js +7 -4
- package/dist/executors/maven/maven.impl.d.ts.map +1 -1
- package/dist/executors/maven/maven.impl.js +11 -2
- package/dist/plugins/dependencies.d.ts +1 -1
- package/dist/plugins/dependencies.d.ts.map +1 -1
- package/dist/plugins/dependencies.js +2 -24
- package/dist/plugins/maven-data-cache.d.ts +2 -0
- package/dist/plugins/maven-data-cache.d.ts.map +1 -1
- package/dist/plugins/maven-data-cache.js +13 -0
- package/dist/plugins/nodes.d.ts.map +1 -1
- package/dist/plugins/nodes.js +2 -0
- package/package.json +3 -3
|
@@ -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;
|
|
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,CAkHtD"}
|
|
@@ -44,13 +44,16 @@ function buildTaskData(options, projectName) {
|
|
|
44
44
|
/**
|
|
45
45
|
* Build tasks map from task graph and inputs
|
|
46
46
|
*/
|
|
47
|
-
function buildTasks(taskGraph, inputs) {
|
|
47
|
+
function buildTasks(taskGraph, inputs, context) {
|
|
48
48
|
const tasks = {};
|
|
49
49
|
for (const taskId of Object.keys(taskGraph.tasks)) {
|
|
50
50
|
const task = taskGraph.tasks[taskId];
|
|
51
|
-
const projectName = task.target.project;
|
|
52
51
|
const options = inputs[taskId];
|
|
53
|
-
|
|
52
|
+
const nxProjectName = task.target.project;
|
|
53
|
+
const projectConfig = context.projectGraph?.nodes?.[nxProjectName]?.data;
|
|
54
|
+
const mavenProject = projectConfig?.metadata?.mavenProject ||
|
|
55
|
+
nxProjectName;
|
|
56
|
+
tasks[taskId] = buildTaskData(options, mavenProject);
|
|
54
57
|
}
|
|
55
58
|
return tasks;
|
|
56
59
|
}
|
|
@@ -62,7 +65,7 @@ async function* mavenBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
|
62
65
|
// Get batch runner JAR path
|
|
63
66
|
const batchRunnerJar = getBatchRunnerJar();
|
|
64
67
|
// Build task map for batch runner
|
|
65
|
-
const tasks = buildTasks(taskGraph, inputs);
|
|
68
|
+
const tasks = buildTasks(taskGraph, inputs, context);
|
|
66
69
|
// Build arguments for batch runner
|
|
67
70
|
const args = [];
|
|
68
71
|
if (overrides.__overrides_unparsed__?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maven.impl.d.ts","sourceRoot":"","sources":["../../../src/executors/maven/maven.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"maven.impl.d.ts","sourceRoot":"","sources":["../../../src/executors/maven/maven.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsE/C;;GAEG;AACH,wBAA8B,aAAa,CACzC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAe/B"}
|
|
@@ -7,6 +7,15 @@ const run_commands_impl_1 = tslib_1.__importDefault(require("nx/src/executors/ru
|
|
|
7
7
|
const detect_maven_executable_1 = require("../../utils/detect-maven-executable");
|
|
8
8
|
const nxMavenApplyGoal = 'dev.nx.maven:nx-maven-plugin:apply';
|
|
9
9
|
const nxMavenRecordGoal = 'dev.nx.maven:nx-maven-plugin:record';
|
|
10
|
+
/**
|
|
11
|
+
* Get the Maven project coordinates (groupId:artifactId) from project metadata.
|
|
12
|
+
* Falls back to the Nx project name if metadata is not available.
|
|
13
|
+
*/
|
|
14
|
+
function getMavenProjectName(context) {
|
|
15
|
+
const projectConfig = context.projectGraph?.nodes?.[context.projectName]?.data;
|
|
16
|
+
return (projectConfig?.metadata?.mavenProject ||
|
|
17
|
+
context.projectName);
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* Build Maven command arguments
|
|
12
21
|
*/
|
|
@@ -48,9 +57,9 @@ function buildMavenArgs(options, projectName, useMaven4) {
|
|
|
48
57
|
*/
|
|
49
58
|
async function mavenExecutor(options, context) {
|
|
50
59
|
const mavenExecutable = (0, detect_maven_executable_1.detectMavenExecutable)(devkit_1.workspaceRoot);
|
|
51
|
-
const
|
|
60
|
+
const mavenProject = getMavenProjectName(context);
|
|
52
61
|
const useMaven4 = (0, detect_maven_executable_1.isMaven4)(devkit_1.workspaceRoot);
|
|
53
|
-
const args = buildMavenArgs(options,
|
|
62
|
+
const args = buildMavenArgs(options, mavenProject, useMaven4);
|
|
54
63
|
return (0, run_commands_impl_1.default)({
|
|
55
64
|
command: mavenExecutable,
|
|
56
65
|
cwd: devkit_1.workspaceRoot,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateDependencies } from '@nx/devkit';
|
|
2
2
|
/**
|
|
3
3
|
* Create dependencies between Maven projects by analyzing the createNodesResults
|
|
4
|
-
* Uses
|
|
4
|
+
* Uses in-memory Maven analysis data that was stored by createNodes
|
|
5
5
|
*/
|
|
6
6
|
export declare const createDependencies: CreateDependencies;
|
|
7
7
|
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/plugins/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/plugins/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAU,MAAM,YAAY,CAAC;AAIxD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAmChC,CAAC"}
|
|
@@ -3,35 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createDependencies = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const maven_data_cache_1 = require("./maven-data-cache");
|
|
6
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
7
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
8
|
-
const types_1 = require("./types");
|
|
9
|
-
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
7
|
/**
|
|
13
8
|
* Create dependencies between Maven projects by analyzing the createNodesResults
|
|
14
|
-
* Uses
|
|
9
|
+
* Uses in-memory Maven analysis data that was stored by createNodes
|
|
15
10
|
*/
|
|
16
11
|
const createDependencies = async (options, context) => {
|
|
17
|
-
const
|
|
18
|
-
...types_1.DEFAULT_OPTIONS,
|
|
19
|
-
...options,
|
|
20
|
-
};
|
|
21
|
-
// Get cache path based on options
|
|
22
|
-
const optionsHash = (0, devkit_internals_1.hashObject)(opts);
|
|
23
|
-
const cachePath = (0, maven_data_cache_1.getCachePath)(context.workspaceRoot, optionsHash);
|
|
24
|
-
const mavenCache = (0, maven_data_cache_1.readMavenCache)(cachePath);
|
|
25
|
-
// Find all pom.xml files (same as createNodesV2)
|
|
26
|
-
const configFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [
|
|
27
|
-
'**/pom.xml',
|
|
28
|
-
]);
|
|
29
|
-
// Calculate the same hash as createNodesV2
|
|
30
|
-
const projectRoots = configFiles.map((file) => (0, path_1.dirname)(file));
|
|
31
|
-
const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, opts, context);
|
|
32
|
-
const hash = (0, devkit_1.hashArray)(hashes);
|
|
33
|
-
// Get cached Maven analysis data that was generated by createNodesV2
|
|
34
|
-
const mavenData = mavenCache[hash];
|
|
12
|
+
const mavenData = (0, maven_data_cache_1.getCurrentMavenData)();
|
|
35
13
|
if (!mavenData) {
|
|
36
14
|
devkit_1.logger.verbose('[Maven Dependencies] No Maven data found in workspace:', context.workspaceRoot);
|
|
37
15
|
return [];
|
|
@@ -11,4 +11,6 @@ export declare function writeMavenCache(cachePath: string, cache: Record<string,
|
|
|
11
11
|
* Get the cache path for a given options hash
|
|
12
12
|
*/
|
|
13
13
|
export declare function getCachePath(workspaceRoot: string, optionsHash: string): string;
|
|
14
|
+
export declare function setCurrentMavenData(data: MavenAnalysisData): void;
|
|
15
|
+
export declare function getCurrentMavenData(): MavenAnalysisData | null;
|
|
14
16
|
//# sourceMappingURL=maven-data-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maven-data-cache.d.ts","sourceRoot":"","sources":["../../src/plugins/maven-data-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAQnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GACvC,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,MAAM,CAOR"}
|
|
1
|
+
{"version":3,"file":"maven-data-cache.d.ts","sourceRoot":"","sources":["../../src/plugins/maven-data-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAQnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GACvC,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,MAAM,CAOR;AAQD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAEjE;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,GAAG,IAAI,CAE9D"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readMavenCache = readMavenCache;
|
|
4
4
|
exports.writeMavenCache = writeMavenCache;
|
|
5
5
|
exports.getCachePath = getCachePath;
|
|
6
|
+
exports.setCurrentMavenData = setCurrentMavenData;
|
|
7
|
+
exports.getCurrentMavenData = getCurrentMavenData;
|
|
6
8
|
const path_1 = require("path");
|
|
7
9
|
const devkit_1 = require("@nx/devkit");
|
|
8
10
|
/**
|
|
@@ -30,3 +32,14 @@ function writeMavenCache(cachePath, cache) {
|
|
|
30
32
|
function getCachePath(workspaceRoot, optionsHash) {
|
|
31
33
|
return (0, path_1.join)(workspaceRoot, '.nx', 'workspace-data', `maven-${optionsHash}.hash`);
|
|
32
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Module-level variable to pass Maven analysis data from createNodes to createDependencies
|
|
37
|
+
* without relying on hash matching (which can differ when projects use <includes>/<excludes>).
|
|
38
|
+
*/
|
|
39
|
+
let currentMavenData = null;
|
|
40
|
+
function setCurrentMavenData(data) {
|
|
41
|
+
currentMavenData = data;
|
|
42
|
+
}
|
|
43
|
+
function getCurrentMavenData() {
|
|
44
|
+
return currentMavenData;
|
|
45
|
+
}
|
|
@@ -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;
|
|
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,CAoEzD,CAAC"}
|
package/dist/plugins/nodes.js
CHANGED
|
@@ -49,6 +49,8 @@ exports.createNodes = [
|
|
|
49
49
|
// Cache the results with the hash
|
|
50
50
|
mavenCache[hash] = mavenData;
|
|
51
51
|
}
|
|
52
|
+
// Store in module-level variable for createDependencies to use
|
|
53
|
+
(0, maven_data_cache_1.setCurrentMavenData)(mavenData);
|
|
52
54
|
// Return createNodesResults (atomization now handled in Kotlin)
|
|
53
55
|
return mavenData.createNodesResults.map(([configFile, createNodesResult]) => {
|
|
54
56
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/maven",
|
|
3
|
-
"version": "22.5.
|
|
3
|
+
"version": "22.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nx plugin for Maven integration",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"author": "Victor Savkin",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nx/devkit": "22.5.
|
|
49
|
+
"@nx/devkit": "22.5.1",
|
|
50
50
|
"@xmldom/xmldom": "^0.8.10",
|
|
51
51
|
"tslib": "^2.3.0"
|
|
52
52
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/xmldom": "^0.1.34",
|
|
57
57
|
"jest": "^30.0.2",
|
|
58
58
|
"memfs": "^4.9.2",
|
|
59
|
-
"nx": "22.5.
|
|
59
|
+
"nx": "22.5.1",
|
|
60
60
|
"ts-jest": "^29.4.0",
|
|
61
61
|
"typescript": "~5.9.2"
|
|
62
62
|
},
|