Why isnt the EntityZombieHusk working here? I'm using 1.16.5 jar file for this
package com.TheRealBee.mob;
public class CustomPet extends EntityZombieHusk{}
Any help is appreciated My IDE has a function that makes it so that if the class is not imported it would give you suggestions on what to import but none showed up
Error type: Cannot resolve symbol "EntityZombieHusk"
Edit: I forgot to import the spigot-1.16.5.jar
The IDE returns an error because it doesn't know where the EntityZombieHusk class is. That class in not present in the Bukkit/Spigot API, which means you have to import NMS (net.minecraft.server) to use it.
To import NMS:
Maven:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>version</version>
<scope>provided</scope>
</dependency>
Gradle:
compileOnly "org.spigotmc:spigot:version"
Note: Make sure to change the version; otherwise, it won't work.
Related
I am developing a kotlin multiplatform project, which has a bunch of modules.
I have written an extension function which is meant to be used inside each module. The extension function extends functionality of KotlinMultiplatformExtension class. Now that code is repeated inside each module's build.gradle.kts file. So i thought it would be great to move that code to buildSrc moudle and reuse everywhere.
The problem is that inside buildSrc module KotlinMultiplatformExtension is not resolved.
My buildSrc/build.gradle.kts:
plugins {
`kotlin-dsl`
}
repositories {
jcenter()
}
If i right click KotlinMultiplatformExtension inside someModule/build.gradle.kts
it takes me to:
So I guessed that adding a dependency inside buildSrc/build.gradle.kts should help:
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
}
But adding that results with an error:
* Exception is:
java.lang.NoClassDefFoundError: com/android/build/gradle/BaseExtension
at org.jetbrains.kotlin.gradle.plugin.AbstractAndroidProjectHandler.configureTarget(KotlinPlugin.kt:765)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin$Companion.applyToTarget(KotlinPlugin.kt:727)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin.apply(KotlinPlugin.kt:689)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin.apply(KotlinPlugin.kt:678)
at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:102)
Any ideas how to make KotlinMultiplatformExtension available inside buildSrc?
Turns out that changing
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
into
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
resolves problem with the exception (java.lang.NoClassDefFoundError: com/android/build/gradle/BaseExtension)
and makes KotlinMultiplatformExtension available inside the buildSrc's source files.
solution found here:
https://github.com/gradle/gradle/issues/9209
I have this in my script
import groovy.io.FileType
.....
derp = new File("blah")
The script works but inetillij complains it cant resolve "File" and it suggested I import a totally different wrong library for it (com.jidesoft.icons.IconSet)
I already tried invalidating cache and restarting
How do I get intelllij to import groovy.io.FileType? I cant even find a way to suppress error either it doesnt give me that option
groovy.io.FileType is an enum class. It appears your variable derp would be of type File, not FileType.
You can statically import enums from the FileType class (for example):
import static groovy.io.FileType.*
In my Intellij on Java 8 the File class comes from the java.io package in a .groovy file.
When pasting Kotlin code from another class with "static" imports, e.g.:
#SpringBootTest(webEnvironment = RANDOM_PORT)
I would like IDE to add import like this
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.*
But instead of that IntelliJ Idea (version 2018.1.1) changes the pasted code to
#SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
and adds
import org.springframework.boot.test.context.SpringBootTest
Is that bug or feature and can I change it?
This is a shortcoming of the current version of the Kotlin plugin. I've filed an issue to improve the behavior in future versions.
I am not allowed to use FileUtils in the program and error is shown when doing so. Even no suggestion is showing to import this pre-defined Class. I tried to search the solution but what I found was to import the class. But in my case even suggestion is not showing to import any class. Hovering on the "FileUtils" shows the suggestion to create FileUtils class/interface. Below is my code:
package captureScreenshot;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils; //Getting Error at this line
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import com.google.common.io.Files;
public class FacebookScreenshot {
#Test
public void captureScreenshot() throws IOException
{
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com");
driver.findElement(By.xpath("//input[#name='firstname']")).sendKeys("Anil Kumar");
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyfile(source,new File("./Screenshots/facebook.png")); //Getting error at this line
driver.quit();
}
}
FileUtils Class
FileUtils Class is defined in org.apache.commons.io.FileUtils which provides the general file manipulation utilities in the following areas :
writing to a file
reading from a file
make a directory including parent directories
copying files and directories
deleting files and directories
converting to and from a URL
listing files and directories by filter and extension
comparing file content
file last changed date
calculating a checksum
org.apache.commons.io is bundled along with selenium-server-standalone-x.y.z by default and available ready to use.
But the behavior you are observing is pretty much inline with your usecase where you mentioned that you are not allowed to use FileUtils in the program. It can be either of the scenarios as mentioned below :
Incase you are using JARs from selenium-java-3.9.1 client, the JAR containing org.apache.commons.io is not being added to your project.
Incase you are using Maven with selenium-java-3.9.1 client dependency the modules containing FileUtils Class have been excluded.
For the following above mentioned reasons, when you mention FileUtils in your program it doesn't show any suggestion to import the class. Moreover if you forcefully provide the import, it will show error on that line.
The line FileUtils.copyFile(); has been updated to FileHandler.copy()
Yes with Selenium Latest version we should use FileHandler.copy()
It works and doesn't throw any error.
// Take Screenshots example
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileHandler.copy(scrFile, new File("<your path>\\screenshot.png"));
download maven commons-io jars from: https://mvnrepository.com/artifact/commons-io/commons-io
and add jars to your build Path in your project
In the above FileHandler.copy(scrFile, new File("\screenshot.png"));
here copy -the method copy(File, File) is undefined for the type FileHandler is occured
I just installed rxjs 5 beta 3 via npm i rxjs#5.0.0-beta.3.
I have the following example code:
import {Observable} from "rxjs"
new Observable(o => o.next(42)).filter(() => true);
This code compiles perfectly well when using ts-node for example.
But when looking at this code inside IntelliJ IDEA, the filter() operator is not found.
When using operators on an Observable instance, they are not found either.
The suggested static members of Observable are:
create()
if()
throw()
The suggested members of an instance of Observable are:
_isScalar()
forEach()
lift()
subscribe()
I also tried to import only what I need, but still my IDE tells me that filter() does not exist on the Observable instance:
import {Observable} from "rxjs/Observable"
import "rxjs/add/operator/filter"
new Observable(o => o.next(42)).filter(() => true);
Any suggestions how to make IntelliJ IDEA know about the operators?
To fix this issue you need to add RxJS as a javascript library in IntelliJ:
Go to Settings -> Languages and frameworks -> JavaScript -> Libraries
Click Add...
Add node_modules/rxjs by clicking the + button
Click all the OK buttons until you are back in your editor.
This solution is tested to work on IDEA 2016.1.3
Please, check IDEA 2016.1.2 or higher
Note: Directory node_modules must be not excluded from the project.
Otherwise, see answer https://stackoverflow.com/a/38499577/1057218
Note 2: File package.json must contain the direct dependency (or devdependency) 'rxjs'
Accepted answer doesn't work. I have tested IntelliJ IDEA 2016.2.1 EAP (ideaIU-162.1447.7) and the problem still persist.
The rabbit hole goes as follows:
In the accepted answer you find a link to version 2016.1, but that doesn't fix the problem.
Then you see a comment with a link to the IntelliJ bugtracker, where OP has the first/top comment.
At the bottom of that issue/bug thread you find a comment saying IDEA 2016.2 162.426.1 EAP will definitely fix the problem, it doesn't.
Bottom line, if you import all of what RxJS has to offer with import {Observable} from 'rxjs/Rx'; IntelliJ will still complain that it can't find methods like .map and .filter