Skip to content

Commit abb3506

Browse files
authored
fix(databricks-jdbc-driver): Failed to read package.json issue (#7311)
1 parent e2569a9 commit abb3506

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/cubejs-cli/src/command/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const create = async (projectName, options) => {
9191
logStage('Installing JDBC dependencies');
9292

9393
// eslint-disable-next-line import/no-dynamic-require,global-require,@typescript-eslint/no-var-requires
94-
const JDBCDriver = require(path.join(process.cwd(), 'node_modules', '@cubejs-backend', 'jdbc-driver', 'driver', 'JDBCDriver'));
94+
const JDBCDriver = require(path.join(process.cwd(), 'node_modules', '@cubejs-backend', 'jdbc-driver'));
9595

9696
const { jdbcDriver } = await inquirer.prompt([{
9797
type: 'list',

packages/cubejs-jdbc-driver/src/JDBCDriver.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { BaseDriver } from '@cubejs-backend/base-driver';
1515
import * as SqlString from 'sqlstring';
1616
import { promisify } from 'util';
1717
import genericPool, { Factory, Pool } from 'generic-pool';
18+
import path from 'path';
1819

1920
import { DriverOptionsInterface, SupportedDrivers } from './supported-drivers';
2021
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -37,7 +38,10 @@ type JdbcStatement = {
3738
const initMvn = (customClassPath: any) => {
3839
if (!mvnPromise) {
3940
mvnPromise = new Promise((resolve, reject) => {
40-
mvn((err: any, mvnResults: any) => {
41+
const options = {
42+
packageJsonPath: `${path.join(__dirname, '../..')}/package.json`,
43+
};
44+
mvn(options, (err: any, mvnResults: any) => {
4145
if (err && !err.message.includes('Could not find java property')) {
4246
reject(err);
4347
} else {

0 commit comments

Comments
 (0)