I'm having trouble adding a .jar externally, notice that the .jar in the correct location, apparently has been added to the project, is ms-azure-cs-faceapi.jar, I added by clicking on add external JARs.
I'm using this library in a class only, and after adding it to the path the errors are gone, there are no errors in the system, at least red dots are not appearing in any folder, apparently everything is all right.
However, when I run the "clean install" appear these errors in the console:
[ERROR]/I:/system/execs/eclipse/test/src/main/java/TestFaceapi.java:[26,67] package com.microsoft.azure.cognitiveservices.vision.faceapi.models does not exist
[ERROR] /I:/system/execs/eclipse/test/src/main/java/TestFaceapi.java:[190,31] cannot find symbol
[ERROR] symbol: class FaceAPI
[ERROR] location: class TestFaceapi
[ERROR] /I:/system/execs/eclipse/test/src/main/java/TestFaceapi.java:[239,38] cannot find symbol
[ERROR] symbol: class FaceAPI
[ERROR] location: class TestFaceapi
As I said, in the class there is no error, everything is ok, but I can not climb the application due to this error ... does anyone have an idea of what might be missing when importing .jar externally?
Related
I am using IntelliJ.
I have added the JAR - https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client/2.0-m04
To my project,
{{ import org.glassfish.jersey.client.JerseyClientBuilder; }}
despite this I still get a compile error .
Error:(3, 35) java: cannot find symbol
symbol: class JerseyClientBuilder
location: package org.glassfish.jersey.client
I did have a lot of errors due to missing JARS , but I just found them on the web and added them to the project under project structure and that sorted all the errors except for the jersey Client Builder ...
I have a Intellij plugin project that I can successfully build without using the PsiMethod class. I've generated this project using this intellij plugin guide
As soon as I add in code using PsiMethod class
(from the Intellij SDK code_samples directory)
The intellisense cannot find any GOTO information for the class.
I can then switch my project settings module from JAVA_1.8.0 to
by adding it into the platform settings SDKs:
This now adds intellisense, and gives me the ability to navigate to the PsiMethod class by CMD+click.
However, If I try and run my "plugin" gradle configratuion. it halts with an error running :runIde.
Running compileJava command from bash I get:
$ ./gradlew compileJava
> Task :compileJava FAILED
/Users/cody/IdeaProjects/plugintest/src/main/java/com/plugintest/TestClass.java:104: error: cannot find symbol
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
^
symbol: class PsiMethod
location: class ParticleContainerManager
/Users/cody/IdeaProjects/plugintest/src/main/java/com/plugintest/TestClass.java:104: error: cannot find symbol
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
^
symbol: class PsiMethod
location: class ParticleContainerManager
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
The gradle source sets in intellij are as follows:
And when I CMD+Click the PsiMethod class, it shows the following JAR source:
This source is in the following parent folder:
How can I add this source into my gradle configuration? shouldn't it be autodetecting what my projects intellisense is tapping into?
Do I need to change something in the gradle.* files inside the project directory?
EDIT:
Using Yann's Answer:
I've added the following line to my build.gradle file:
intellij {
version '2019.2'
plugins 'java'
}
and it works!
Please make sure to add Java plugin as separate dependency. This is now necessary starting with 2019.2: https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/
Jenkins maven project shows [ERROR] COMPILATION ERROR after step
--- maven-compiler-plugin:3.8.1:testCompile (default-testCompile).
All selenium-elements are non-recognized. Also, there are rather strange slashes "/" instead of "\" in files paths.
If compilation starts through maven:surefire in IntelijIdea, such problems don't appear.
Here are links to Jenkins configure and pom.xml photos
[Jenkins conf1]https://prnt.sc/ox1wzb
[Jenkins conf2]https://prnt.sc/ox1yye
[pom1]https://prnt.sc/ox1xzg
[pom2]https://prnt.sc/ox2y21
What could be the mistake?
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[5,27] package org.openqa.selenium does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[6,27] package org.openqa.selenium does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[7,34] package org.openqa.selenium.chrome does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[8,35] package org.openqa.selenium.support does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[9,38] package org.openqa.selenium.support.ui does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[13,19] cannot find symbol
symbol: class WebDriver
location: class script_1_2_3.WebDriverSettings
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/WebDriverSettings.java:[14,19] cannot find symbol
symbol: class WebDriverWait
location: class script_1_2_3.WebDriverSettings
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[3,27] package org.openqa.selenium does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[4,27] package org.openqa.selenium does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[5,35] package org.openqa.selenium.support does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[6,38] package org.openqa.selenium.support.ui does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/ListsOperating.java:[3,27] package org.openqa.selenium does not exist
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[12,71] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[13,59] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[14,59] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[15,59] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[16,59] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[17,59] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
[ERROR] /C:/Program Files (x86)/Jenkins/workspace/roz/src/test/java/script_1_2_3/PageObjects.java:[18,64] cannot find symbol
symbol: class WebElement
location: class script_1_2_3.PageObjects
The reason is what the Java compiler cannot find classes that you refer. None of libraries that you defined in pom.xml contains org.openqa.selenium. Add Selenium library.
Also, before compiling on Jenkins, why have you not compiled it locally? It would be much easier to first make it compiling and running locally, and only then put it to Jenkins.
You need to consider three below things to solve this issue:
Jenkins:
Once You have Jenkins install, make sure you install Maven Plugins from “Manage Jenkins Manage Plugins”
Then add the Simple New Item, As Maven Project.
Keep everything as it is, Add POM details under Build section.
You can set the Goals and Options as: clean install or test as well.
Java:
Check the JAVA_HOME file version and add the JDK version accordingly everywhere.
Maven:
Make sure you are using the right version of JDK or JRE for the compilation. (Common error of compilation come here)
In eclipse, go to “Window Preference Java Installed JRE Apply the JRE from Execution Environments”
Add Maven Compilation Plugins into POM.XML. o Make sure you have correct version of JDK
Below is the sample format.
I have Issue with using database
I was going with this tutorial
http://vimeo.com/58969923# (one from playframework.com page)
in the model:
play-2.2.1/jcirs/app/models/MedicalIncident.java
public class MedicalIncident extends Model{}
I am trying to use Entity. For that I have to import:
javax.persistence.* and play.db.ebean.*
but none of them can be found.
The error is
package javax.persistence does not exist
What should I do?
Use any other database engine? Or should download some dependency.
I would like to go with playframework best way.
Please help.
My configuration
application.conf:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
ebean.default="models.*"
stack trace:
[jcirs] $ run 8081
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:8081
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 5 Scala sources and 5 Java sources to /home/daniel/play-2.2.1/jcirs/target/scala-2.10/classes...
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:4: error: package javax.persistence does not exist
[error] import javax.persistence.*;
[error] ^
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:6: error: package play.db.ebean does not exist
[error] import play.db.ebean.*;
[error] ^
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:14: error: cannot find symbol
[error] public class MedicalIncident extends Model {
[error] ^
[error] symbol: class Model
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:13: error: cannot find symbol
[error] #Entity
[error] ^
[error] symbol: class Entity
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:15: error: cannot find symbol
[error] #id
[error] ^
[error] symbol: class id
[error] location: class MedicalIncident
[error] /home/daniel/play-2.2.1/jcirs/app/controllers/MedicalIncident.java:21: error: cannot find symbol
[error] MedicalIncident medical_incident = Form.form(MedicalIncident.class).bindFormRequest().get();
[error] ^
[error] symbol: variable Form
[error] location: class MedicalIncident
[error] 6 errors
[error] (compile:compile) javac returned nonzero exit code
[error] application -
! #6gfjpj0cf - Internal server error, for (GET) [/] ->
play.PlayExceptions$CompilationException: Compilation error[error: package javax.persistence does not exist]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:304) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:298) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
[warn] play - No application found at invoker init
Have you updated your project dependencies in Build.scala?
Not sure if anything has changed in Play 2.2.1 but for Play 2.1.3 dependencies in Build.scala would look like this:
val appDependencies = Seq(
javaCore,
javaJdbc,
javaEbean
)
EDIT:
Once you update your dependencies in Build.scala don't forget to update dependencies in your IDEA or Eclipse by running corresponding play command, e.g.
play idea
Playframework is generating the IDEA specific files when you run "play idea" (if you're using Eclipse, run "play eclipse"). If you imported the project in the same way the tutorial explained, you should have the necessary JARs already available in the project.
If it's still not working, verify if IDEA correctly assigned a JDK to your project.
Try to understand what this framework is doing under the hood, don't just try to make it work and ignore the important stuff.
I had the same problem and I was using Eclipse. I included #Entity, e.g. and in my project console I typed eclipse with-source=true. After a "Refresh" in my Eclipse project and a "Clean", it brings me all JARs and then I clicked on the issue and the IDE offered the possibility to include javax.persistence.*, play.db.ebean.Model, etc.
I was having the same problem, while using a heavily modified version of Eclipse Neon. The clue to solving it for me, was that the only place I was seeing the errors was during a Maven build. The Eclipse IDE was able to compile and run the program just fine.I was able to solve it by adding a couple of dependencies to the project's pom.xml file. See below for the xml code for the dependencies.I was able to get the groupId's and artifactId's versions by drilling down the directories out on Maven Central. I just walked the tree until I found the metadata.xml files for the persistence.core and the persistence.jpa artifacts.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.4</version>
<scope>compile</scope>
</dependency>
In eclipse when I compiled my GWT-modules then I got successful
compilation but when I tried to run my ant script for gwt compilation
I got the following error messages :
[ERROR] Errors in 'file: ../../../... .java'
[java] [ERROR] Line 19: The import com.ensarm.......
cannot be resolved
Finding entry point classes
[java] [ERROR] Unable to find type .....*
[java] [ERROR] Hint: Previous compiler errors may have
made this type unavailable
[java] [ERROR] Hint: Check the inheritance chain from
your module; it may not be inheriting a required module or a module
may not be adding its source path entries properly..
Any idea/suggestion guys ?
Thanks,
Sachin.
Looking at the error it seems that you are missing some jar containing containing the missing classes. You need need to add that jar to the class path. Eclipse can find it but for the ant target the 'compile path' provided should include that jar.
Can you make sure it is there in your compile path.