Skip to content

Commit

Permalink
fix(databricks-jdbc-driver): Failed to read package.json issue (#7311)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeNitsenko committed Oct 26, 2023
1 parent e2569a9 commit abb3506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cubejs-cli/src/command/create.ts
Expand Up @@ -91,7 +91,7 @@ const create = async (projectName, options) => {
logStage('Installing JDBC dependencies');

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

const { jdbcDriver } = await inquirer.prompt([{
type: 'list',
Expand Down
6 changes: 5 additions & 1 deletion packages/cubejs-jdbc-driver/src/JDBCDriver.ts
Expand Up @@ -15,6 +15,7 @@ import { BaseDriver } from '@cubejs-backend/base-driver';
import * as SqlString from 'sqlstring';
import { promisify } from 'util';
import genericPool, { Factory, Pool } from 'generic-pool';
import path from 'path';

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

0 comments on commit abb3506

Please sign in to comment.