Ktor: Can't import dependencies - ktor

I have created the sample Ktor project in IntelliJ IDEA.
I added the following dependencies to build.gradle.kts:
implementation("org.ktorm:ktorm-core:3.4.1")
implementation("io.reactivex.rxjava3:rxkotlin:3.0.0")
It looks like the dependencies are found, as the project builds and runs.
I am trying to add imports to the source code:
import org.ktorm.database.*
import io.reactivex.Completable
The IDE doesn't see packages org.ktorm nor io.reactivex.
What can I do to use Ktorm or RxJava in Ktor? It looks like it doesn't see any dependencies I add.

I have figured it out. After adding a dependency select File->Invalidate caches, and then click the button "Invalidate and restart".

Related

How to quickly import `package.json` as npm-module?

In IntelliJ I am used to create IntelliJ-Modules out of Maven pom.xml files. I just rightclick on the pom and choose + Add as Maven Project.
Is there something similar for npm modules? Maybe by rightclicking on the package.json file?
I do not want to use the cumbersome way of navigating to Project structure, Modules and clicking on +, import Module, and so on.

Groovy Project Setting in IDEA IntelliJ

I'm using IDEA to write groovy scripts for my jenkins job. So I have these imports
import groovy.json.JsonSlurper
import hudson.FilePath
import hudson.model.Node
import hudson.model.Slave
import jenkins.model.Jenkins
Before I added jenkins-core-2.9.jar into the project dependency, those jenkins classes are marked in red. Then I added the jar as a dependency by "File"->"Project Structure"->"Modules"->"Dependencies"
Then those red marks are gone. However, when I tried to run the script, it says Error:(14, 1) Groovyc: unable to resolve class jenkins.model.Jenkins. What else do I need to do?
I had the same problem and it was a permission issue. For me this command fixed it: sudo chmod o=r jenkins-core-2.73.3.jar
As stated in this link,
Note that if you configure a dependency through the Project Structure dialog, the dependency will only appear in the IntelliJ IDEA Project tool window, not in the Gradle tool window.
Adding the dependency like this only adds the dependency in the idea workspace. When you run the task either from the gradle tool window, or from an external command line tool, that dependency no longer exists. You should add it to your gradle dependencies:
dependencies {
compile "org.jenkins-ci.main:jenkins-core:2.9"
}
You can configure a repository to load this dependency from. This repository can be a file path, or a maven repository etc.
See here for more details on gradle dependency management.

How to import COM4j as Eclipse Plugin?

I am following the guide shown in https://molteni.wordpress.com/2012/10/16/connect-hp-quality-center-with-java-using-com4j-tutorial/ to generate resources of COM4J.
This is how the COM4J folder looks like
I tried to create an Eclipse plugin based on it and show as below
However when I added the plugin as one of the dependencies of my application I am unable to import the file.
I get the following error when I tried to search it through "Open Type" in Eclipse as follow
What steps am I missing here ?
Usually it is done like this: in Eclipse go to File ->
New -> Plugin Development -> Plugin From Existing Jar Files
Though it might not help in this case: please see this issue: https://java.net/jira/browse/COM4J-57
It sounds like you have not specified which classes are exported by the plugin.
Open the MANIFEST.MF editor for the plugin and select the Runtime tab. In the 'Exported Packages' section click Add and select all the packages which should be available to other plugins.

How to use gradle in intellij idea plugin project?

I am developing an idea plugin, and it is an intellij idea project.
I want to use gradle to manage the dependency.
How to config?
There is now a Gradle plugin for building IntelliJ Platform Plugins. In order to use it, you will need to add the following snippet to your build.gradle file.
plugins {
id "org.jetbrains.intellij" version "0.0.31"
}
apply plugin: 'org.jetbrains.intellij'
For more information, please see this guide to help you get started.
Ok, there are multiple ways to create an IntelliJ project, "templates" if you like, and unfortunately you can only pick one of them (IntelliJ plugin or gradle).
Thankfully, it's easy to configure a project for gradle in IntelliJ.
First, create a new project from the IntelliJ Platform Plugin template. You don't need to choose any Additional Libraries and Frameworks. This will give you a project structure including META-INF/plugin.xml and the Project SDK should be something like IDEA IU-129.451.
From here, simply create a new file named build.gradle at the top level of your project, including for example this line:
apply plugin: 'java'
Now, close the project. You can now use File -> Import Project..., choose the build.gradle file that you just created, and import the project. Accept the defaults for importing and hit OK.
The project is now opened with both gradle and intellij plugin enabled!
Notice that the source root src has disappeared and you will need to right click on src in the Project pane and select Mark Directory As -> Source Root.
To prepare the plugin for deployment, there is still the menu option in the Build menu for that - if you want to automate that part via gradle, good luck and please let us know how it's done ;)

The import org.eclipse.jface cannot be resolved in Eclipse Luna

I wrote a plugin five years ago and it was correct (with no compiler error) in all version of Eclipse until Luna. When I updated my eclipse to Luna, I got two compiler errors.
The error is because of these two import statements. (The import org.eclipse.jface cannot be resolved, The import org.eclipse.swt cannot be resolved)
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
I wanted to add two new dependencies to the plugin file, but I could not find any relevent. For example, I could not find org.eclipse.jface.resource in dependency page.
Does anyone have any idea why the plugin works in Kepler, but has the above compiler errors in Luna?
Maybe this page can help you:
http://wiki.eclipse.org/JFace#Create_the_Eclipse_SWT.2FJFace_Project
Sections: Identify the Required External JAR Files for SWT and JFace and also Add the org.eclipse.swt Project to Your Java Project
Add you eclipse plugins directory to it in Target Platform. All problem will be resolved