How to configure intelliJ to disply errors in java code like eclipse?
see the screenshot
It does show the errors you expect, if you don't have the JUnit jar files in the classpath.
I created the exact same file as you showed in my IntelliJ and it really shows the errors:
What you might have done is that you have probably accidentally added the jar to the classpath.
Check the External Libraries as you can see in the picture. If there is no JUnit there, then it really is missing.
Now I can easily add the JUnit jar from IntelliJ and you'll notice the difference in the External Libraries:
Here it has been added under External Libraries and the error goes away.
You almost certainly already included the junit library into your IntelliJ project configuration.
This is easy to do, since IntelliJ has a quick action (alt-enter) to Add junit to classpath.
Look in Settings -> Libraries / Global Libraries and you will see it there. :)
Or you can look directly in Settings on the relevant Module -> Dependencies
Either that, or the project you are working in is configured already (perhaps via maven?) to have a junit dependency.
Related
This looks like common issue. I have tried most of solutions on the web. Unfortunately non of them worked for me. I am using IntelliJ 2019.3 Ultimate edition
Cucumber-Java (bundle) and Gherkin (bundle) plugins already there.
Solutions tried:
Check SubType IntelliJ plugin
File types
Plugin
This is Maven project, I got following doubts
Should I add info.cukes to project POM despite of having plugin in the IDE. Even one of my Gradle project also facing the same issue.
Is this mandatory, if so why. Because I can't find cucumber.api.cli.main to set in the Main Class
Answer
You can set the glue location globally by opening "Edit Configurations
-> Defaults -> Cucumber Java -> Glue" and add the package names.
What does this mean
Answer
My project did not have the steps marked as test source root
Can anyone shed some light here please.
This may sound stupid but here I go (there's no silly question after all, right?): I'm working on a JAVA Maven module with IntelliJ IDEA and the code completion feature works fine suggesting classes from both my module and the JDK.
However, the code completion feature does not seem to be aware of classes coming from Maven dependencies my module depends on.
For instance, my module depends on Maven dependencies such as joda-time.
The code completion popup does not suggest classes such as LocalDate.
Here's my code completion configuration:
What am I missing?
Thanks in advance.
Found the solution:
Clicked on File > Invalide caches/restart
Chose Invalidate and Restart
After restarting IntelliJ rebuild indexes from scratch and code completion works like a charm.
If it is a Gradle or Maven Project As shown in the picture, you may need to import your project build.gradle file if Gradle or maven bom.xml file if Maven. It will sync your project and may download required files from gradle or maven server.
#SenzMate Iot Intelligence
I recently updated my sbt setup to version 0.11. As you may know, new SBT uses .ivy2 folder to store/cache all the retrieved jar files. I am using IntelliJ and I would like to know what is the recommended way of importing dependencies to the editor's classpath.
One option is to manually visit .ivy2 folder and select the dependencies. Is there a better/easier way to doing this?
I presume you use the SBT-plugin. According to the instructions on the linked page:
After each change to your dependencies, run gen-idea in the SBT Console. When prompted, reload the project.
I usually run
gen-idea no-classifiers no-sbt-classifiers
(see under "Usage" on github). IntelliJ (11 RC) will then ask you to reload the project, which is usually quite fast. Then the references to your SBT dependencies will be available.
You can try IvyIDEA plug-in.
In general, how well does m2eclipse deal with Maven plugins that modify or amend lifecycle phases?
In particular, I have a project that has a maven-clean-plugin extension to remove an extra generated directory (not in target/) using the configuration filesets tag. This works when running mvn at the command line but not when doing a clean in Eclipse. Is there any way to get m2eclipse to process that plugin?
Another example is flexmojos; there's a lot that can be configured with the flexmojo plugin but those parameters don't seem to get imported by m2eclipse.
Is the integration solely ad-hoc? If m2eclipse embeds Maven, why can't the plugins be executed directly using the underlying pom.xml configuration?
In general, how well does m2eclipse deal with Maven plugins that modify or amend lifecycle phases?
Decently, to my experience. At least for plugin bound to phases from the default lifecycle.
In particular, I have a project that has a maven-clean-plugin extension (...). This works when running mvn at the command line but not when doing a clean in Eclipse. Is there any way to get m2eclipse to process that plugin?
What the clean plugin "extension" is doing and what you're doing (calling mvn clean from Eclipse? calling Project > Clean?) is unclear - at least for me. But maybe have a look at MNGECLIPSE-823 or MNGECLIPSE-156. And don't hesitate to clarify :)
Another example is flexmojos; there's a lot that can be configured with the flexmojo plugin but those parameters don't seem to get imported by m2eclipse.
I don't do flex so the above is too vague for me. But providing a more concrete example might help.
People,
I already searched a lot but I'm not finding my answer..
I did a eclipse plugin that writes junit test cases from source code.
By now, I'm starting to use reflection in my code, but the plugin can't find the classes in the java project being tested!
Is there a way to use the selected project classpath in my plug-in? How??
I've seen many questions like mine out there, but with no answers. Please someone help!
you could perhaps try to write programmatically a launch configuration that includes in the classpath both your plugin source code and the project source code.
By doing this way you should provide a valid entry point to your application.
this article explains how
Otherwise you could try to base your plugin on eclipse jdt using the Abstract Syntax Tree that jdt provides to generate the unit tests.
ref eclipsepedia