Cannot get coc-java to work offline with gradle - eclipse

I am trying to get coc-java to work in an environment where I don't have internet access. I generated my setup with internet access and transferred it to the offline environment, but when I open a java file and do :CocCommand workspace.showOutput and choose coc-java, I get a stacktrace beginning with Cannot download published Gradle versions. at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:165)...Caused by: java.net.UnknownHostException: services.gradle.org. I have gradle 7.4.2 already installed, and have the following settings in ~/.vim/coc-settings.json:
"java.enabled" : true,
"java.autobuild.enabled": true,
"java.codeGeneration.generateComments": true,
"java.implementationsCodeLens.enabled": true,
"java.referencesCodeLens.enabled": true,
"java.completion.enabled" : true,
"java.foldingRange.enabled" : true,
"java.format.comments.enabled" : true,
"java.format.enabled" : true,
"java.format.onType.enabled" : true,
"java.home" : "/usr/java/jdk-11.0.2",
"java.import.gradle.enabled": true,
"java.import.gradle.offline.enabled": true,
"java.import.gradle.home": "/home/me/.opt/gradle/gradle-7.4.2",
"java.import.gradle.user.home": "/home/me/.gradle",
"java.import.gradle.version": "7.4.2",
"java.import.gradle.wrapper.enabled": false,
"java.import.maven.enabled": true,
"java.progressReports.enabled" : false,
"java.trace.server": "verbose",
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/usr/java/jdk-11.0.2",
"default": true
}
]
The coc-java docs says this about java.import.gradle.home: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.
I've tried removing java.import.gradle.version as well, but same issue occurs.
Given that the stacktrace mentions eclipse buildship, I've tried Googling how to change eclipse/buildship settings, but haven't been able to find out how to configure offline settings, if that's even possible. Has anyone been able to get coc-java to work offline with gradle?

TL;DR
Place the gradle-bin zip file in $GRADLE_USER_HOME/wrapper/dists/gradle-<some-version>-bin/<some-hash>/
Long Version
I finally managed to hack my way around it. Even with the two properties set in coc-settings.json:
"java.import.gradle.offline.enabled": true,
"java.import.gradle.wrapper.enabled": false,
... It still seemed to be trying to fetch gradle-7.1.1 from services.gradle.org. After taking a look in $GRADLE_USER_HOME, I noticed a wrapper directory, despite never using gradle-wrapper for anything, so I dug deeper. After a lot of playing around, I managed to get it to work by taking a gradle-7.4.2-bin.zip file I already had and placing it in $GRADLE_USER_HOME/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/. I'm not sure the significance of that hash value nor why it would point to version 7.1.1 of gradle, but after putting the zip file there and opening a java file, it proceeded to create the gradle-7.4.2 folder under that hash folder with everything needed underneath, and coc commands started to work!

Related

Product images issue in vue storefornt

I integrated vue store front with magento 2, frontend works fine but product images not display in frontend. It throws error Unable to compile TypeScript:\nsrc/image/action/local/index.ts(27,18): error TS2339: Property 'query' does not exist on type 'Request<any, any, any, any>'. imagemagick is also installed and imgurl in local.json is also defined.
Anyone please know about this why error display.
It is about this.req which is typeof Request from express - it has query property. Please make sure you have yarn.lock from the original repo and reinstall dependencies.
If you are using docker, you might need to add:
- './yarn.lock/var/www/yarn.lock'
To volumes section in the docker-compose.nodejs.yml
i have found a simple solution you can try that
copy all your magento 2 pub/media data in vue-storefront-api/var/magento-folder/pub/media
Or
create a symlink if you are working on localhost
vue-storefront-api/config/local.json
"magento2": {
"imgUrl": "http://magento-domain/pub/media/catalog/product",
"assetPath": "/../var/magento-folder/pub/media",
}
vue-storefront/config/local.json
"images": {
"useExactUrlsNoProxy": false,
"baseUrl": "http://localhost:8080/img/",
"useSpecificImagePaths": false,
"paths": {
"product": "/catalog/product"
},
"productPlaceholder": "/assets/placeholder.jpg"
},
run command in vue-storefront and vue-storefront-api

ReferenceError: driver is not defined in Protractor

I'm a beginner. Can any one guide me?
Tests.js
describe("Test the calculator",()=>{
it("Addition functionality",function test(){
driver.browser.get("https://juliemr.github.io/protractor-demo/");
browser.manage().window().maximize();
//browser.manage().timeouts().implicitlyWait(3000)
})
})
Config.js
const driver= require("protractor")
exports.config= {
browserName: 'chrome',
framework: "mocha",
directconnect: true,
specs: ['./tests.js'],
mochaOpts: {
timeout: 0
}
}
At run time it display a message as "driver is not defined"
Chrome version: 83.0.4103.61 (Official Build) (64-bit)
Visual Studio code: 1.45.1
I see what's going on...
first of all, don't call protractor a driver. Don't confuse others and most importantly yourself. Protractor is protractor, period.
second, when you do const driver= require("protractor") your driver variable is available in conf.js, but when you call it from the spec, it's not there, because it's a local variable, not global. As simple as that, this is why you get this error
Third, you don't need to define protractor because it is a global variable, and is available anywhere in your project anyways. The same with browser, element, $, $$ they all are available globally in your project.
Fourth, lets assume for whatever GOOD reason you still want to define something that will be globally available just do global.driver = require('protractor') as described here https://stackoverflow.com/a/31208642/9150146, and then you can call by typing the variable name driver

JPAM Configuration for Apache Drill

I'm trying to configure PLAIN authentification based on JPAM 1.1 and am going crazy since it doesnt work after x times checking my syntax and settings. When I start drill with cluster-id and zk-connect only, it works, but with both options of PLAIN authentification it fails. Since I started with pam4j and tried JPAM later on, I kept JPAM for this post. In general I don't have any preferences. I just want to get it done. I'm running Drill on CentOS in embedded mode.
I've done anything required due to the official documentation:
I downloaded JPAM 1.1, uncompressed it and put libjpam.so into a specific folder (/opt/pamfile/)
I've edited drill-env.sh with:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
I edited drill-override.conf with:
drill.exec: {
cluster-id: "drillbits1",
zk.connect: "local",
impersonation: {
enabled: true,
max_chained_user_hops: 3
},
security: {
auth.mechanisms: ["PLAIN"],
},
security.user.auth: {
enabled: true,
packages += "org.apache.drill.exec.rpc.user.security",
impl: "pam",
pam_profiles: [ "sudo", "login" ]
}
}
It throws the subsequent error:
Error: Failure in starting embedded Drillbit: org.apache.drill.exec.exception.DrillbitStartupException: Problem in finding the native library of JPAM (Pluggable Authenticator Module API). Make sure to set Drillbit JVM option 'java.library.path' to point to the directory where the native JPAM exists.:no jpam in java.library.path (state=,code=0)
I've run that *.sh file by hand to make sure that the necessary path is exported since I don't know if Drill is expecting that. The path to libjpam should be know known. I've started Sqlline with sudo et cetera. No chance. Documentation doesn't help. I don't get it why it's so bad and imo incomplete. Sadly there is 0 explanation how to troubleshoot or configure basic user authentification in detail.
Or do I have to do something which is not told but expected? Are there any Prerequsites concerning PLAIN authentification which aren't mentioned by Apache Drill itself?
Try change:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
to:
export DRILL_JAVA_OPTS="$DRILL_JAVA_OPTS -Djava.library.path=/opt/pamfile/"
It works for me.

Protractor test fails on CI

Currently I am trying a setup an end to end protractor tests to a a bitbucket pipelines with set up an headless chrome and i am currently getting some error message:
Failed: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
Any clue for this? how ever running tests locally is working fine; Can i set a constant session id?
Thanks
Check out your configuration file for this object
capabilities: {
"browserName": "chrome",
"chromeOptions": {
"args": ["incognito", "--window-size=1920,1080", "disable-extensions", "--no-sandbox", "start-maximized", "--test-type=browser"],
"prefs": {
"download": {
"prompt_for_download": false,
"directory_upgrade": true,
"default_directory": path.join(process.cwd(), "__test__reports/downloads")
}
}
}
},
When you find it, make sure you included "--no-sandbox" argument into args property.
What this guy does is it allows your tests to be ran from a remote container. In the meantime, if you include the argument when you run your tests on your machine, it has side effects like described here Chrome Instances don't close after running Test Case in Protractor

What is a efpt.config.json file and should it be checked into source control?

I am using Visual Studio and EF Core Power Tools to reverse engineer some models from my database. This creates a efpt.config.json in my directory and I am wondering whether or not this is something that should be checked into source control for my project.
{
"ContextClassName": "MyContext",
"DefaultDacpacSchema": null,
"IdReplace": false,
"IncludeConnectionString": false,
"OutputPath": "",
"ProjectRootNamespace": "My.Name.Space",
"SelectedToBeGenerated": 0,
"Tables": [
...
],
"UseDatabaseNames": true,
"UseFluentApiOnly": true,
"UseHandleBars": false,
"UseInflector": false
}
I am the creator of EF Core Power Tools, and I recommend that you check in this file with your project, doing that ensures that all developers use the same option when running the Reverse Engineer wizard