Some java warnings (e.g. for code order) might apply for one project, but not for the other. How can I reflect this fact in NetBeans where the only setting seems to be the Hint tab in the editor configuration on application level? I could setup the checkstyle maven plugin, but that'd be far from "IDE support" (facing the fact that I'd have to evaluate the output in the browser and then find the referenced line(s) of code in the IDE).
I'm using NetBeans 8.0.2, maven 3.2.5 and and OpenJDK 8.
There's a Hints option to configure warnings per project (overwriting the IDE-wide settings in the Editor section)
Related
I'm new member for IntelliJ. I am trying to install a plugin for Cucumber in IntelliJ IDE.
Following are the steps which I am trying:
File > Settings (Ctrl+Alt+S)
From left hand pane, landing on Plugins tab.
In Search box, I am trying to search "Cucumber for Java".
But no result is displaying for same.
Can anyone help me on this ?
On search I am not able to see the option Cucumber for java, which is visible here in given stack.
Please see the documentation.
Use the Browse Repositories button.
Cucumber for Java plug-in is available out of the box in IntelliJ IDEA Ultimate.
For IntelliJ IDEA Community edition it's available as a free plug-in that you need to install:
In case IDE doesn't see the plugins list, please check the proxy settings. Disabling this option may also help.
It's also possible to download install plugins manually from disk. Make sure to get the version which is compatible with your IntelliJ IDEA build.
Cucumber for Java can be downloaded here.
The version compatible with IntelliJ IDEA 2018.1.x is available by this link.
Please also note that there is no Cucumber for Java plug-in version that is compatible with IntelliJ IDEA 2018.2 EAP builds at the moment. If you need this plug-in, please use 2018.1.4 release version.
I am using IntelliJ IDEA 2017.1.4 as my IDE. Recently I have found a plugin called ASM Bytecode Outline which is actually what I've dreamed of. I need such plugin so that I can convert Java code to ASM code or to bytecode easily.
I have installed the following plugin and restarted my IDE. Then I was expecting to be happy, however I was disappointed because the plugin seems not working:
Simply nothing.
I have tried the following:
Recompile and rebuild the project.
Restart IntelliJ.
Reinstall the plugin.
Restart my PC.
However, as you see me asking here now, you can guess that none from what I tried has worked, sadly. I clearly understand that the plugin might be pretty old and was not updated for years, but I still need at least something similar that can convert Java code to ASM-ready code, like:
.
Is there a way I can solve this, or is there any other similar solution (not required to be an IntelliJ plugin) for what I want?
I updated the plugin and now it works fine with newer versions of Intellij IDEA.
You can download it from here: https://plugins.jetbrains.com/plugin/10302-asm-bytecode-viewer
The source code can be found in here: https://github.com/elitegit/asm-intellij-plugin
It includes the latest version of ASM library as well.
You can use the plugin in 3 different ways:
Right click somewhere inside the code editor and choose "Show
Bytecode Viewer"
In the "Code" menu, choose "Show Bytecode
Viewer"
Right click on the java file in the Project window and
choose "Show Bytecode Viewer"
You can find the setting inside Settings => Tools => "Show Bytecode Viewer"
ASM Bytecode Outline isn't compatible with IntelliJ 2017.1.4. The last time this plugin was updated was September 2015. Here's a link to the plugin page on JetBrains' website: you can see that it stopped being compatible in IntelliJ 14.
Alternative
A built-in bytecode viewer has been available in IntelliJ for a while. Use the menu View -> Show Bytecode to view the bytecode for one of your classes. See this link for more details.
I am maintaining a Java 7 web project that uses multiline annotation to store certain constants.
I could configure Eclipse fine when I was using Mars, so I could launch Tomcat with that application deployed and it worked like a charm...
Until I upgraded!
Now no annotation processing is done despite the configuration.
I have found that this problem is due to a feature of Eclipse 4.6, as documented here
Java 6 annotation processors are supported in the batch compiler and in the IDE. By design, Java 6 processors are only executed during a build, not while editing. (bug 188558)
The linked bug says, in brief, that annotation processing has been removed from Eclipse's incremental compilation (perhaps the Build automatically???) for legitimate reasons. And in fact when I compile my project in CI server using Ant, annotations get processed as usual.
But I can't run my project anymore in Eclipse. It fully depends on the correct processing of the Multiline annotation.
So far, I have tried to disable the Build Automatically flag and manually build the project. No result.
I also tried to go to Java Compiler -> Annotation processing -> Factory Path, select the multiline-string jar, go to Advanced properties and uncheck Run this container's processors in batch mode, despite the checkbox is counterintuitive (I mean, it should be named "Run in incremental mode" and unchecked by default, according to the above mentioned bug)
The application is a web application, so on every attempt I try to deploy it to local Tomcat.
What do you think I can do about it?
A couple of suggestions:
The multiline annotation you are using only supports up to Java version 1.6. (For instance, MultilineProcessor specifies #SupportedSourceVersion(SourceVersion.RELEASE_6), and the recommended pom settings specify source and target values of 1.6.) If your package is building with a JDK Compliance Level greater than 1.6, this is probably why the annotations are being ignored.
Instead of using that annotation, you could just hard-code the multiline strings to your string variables. It would make your code less readable, but builds will be faster.
How do I stop maven from constantly updating my Java System Library from JDK 1.8 back to Java SE 1.8? I have configured the build path and I even set my Java_Home Variable to the JDK path. I have also have updated the build configuration. Can someone please specify how to do this with some specific instructions as I am a novice. I also noticed this keeps changing back as well. FYI I am using Eclipse Mars if that matters.
In Regards to the comments below I have shared the Eclipse M2e Plugin screenshot. Even when selected I am not able to proceed to next. I also have shown what's already installed just in case another plugin is hindering me from using the m2e
You need to understand what an Execution Environment (EE) is in Eclipse. The concept of EE is an abstraction over JREs, allowing projects to be configured without absolute paths to JRE locations. From the wiki page:
Execution environments (EEs) are symbolic representations of JREs. For example, rather than talking about a specific JRE, with a specific name at a specific location on your disk, you can talk about the J2SE-1.4 execution environment. The system can then be configured to use a specific JRE to implement that execution environment.
In general, it's not advisable to configure a project to use "Workspace default" as its JRE System Library, because that makes the project inconsistent when loaded into different workspaces. Think about this: what if the project is being developed targeting Java 7, but I pull it into my workspace which has JDK 8; that could be a big problem. By using an EE, the project is configured such that it doesn't know (or care) where I actually have a matching JRE on my system.
I said all that to set up the answer for you, so you understand what Maven is doing and these instructions are doing. m2e, the Maven integration plugin for Eclipse, is (rightly) setting the project configuration to use an EE instead of "workspace default". From your screen shot I can see that you have both JDK and JRE 1.8 set up in your workspace, so ideally you should remove one (the JRE). Got to Preferences > Java > Installed JREs. There you'll see both the JRE and JDK listed. I suggest removing the JRE*.
Then go into the "Execution Environments" preferences section, select JavaSE-1.8 and make sure that your JDK is checked as the default implementation.
Now when m2e configures your projects to use an EE, that EE will be pointing to the JDK you have installed. And if someone else imports the project, it will point to wherever they have a matching JDK installed.
*By the way, it's perfectly acceptable and normal to have different versions of Java there; I often work on different projects that target different Java versions.
We are using Eclipse for our projects and we would like to revision control the JDK we use. (Different projects need to use different JDKs). Instead of configuring everyone's system to have the same JDK with the same names in Eclipse, we would like to include the JDK as part of our project in our source control tool and have the project point to the JDK that is part of the project.
We can't figure out how to tell Eclipse to use the JDK that is found in the project. It keeps wanting an absolute path to the JDK. Is it possible to use the JDK that is part of a project and use a path that is relative to the project?
Is it possible to use the JDK that is part of a project and use a path
that is relative to the project?
Straight answer: NO
You're asking to go around the basic abstraction that Eclipse provides between installed runtime environments (which are defined at the workspace level) and the project's compiler configuration (which is defined at the project level). If you want to use all the JDT features in Eclipse, you just have to live with configuring the installed JREs on each workspace of each of your developers.
However, I can think of a probably not-so-standard-way (I see the -1's coming for saying this, which is crazy!) to achieve what you want: to distribute the .metadata folder of a pre-configured workspace you've already set up with all your JRE's so you don't have to go on each machine and do the installation. This would also include committing the .settings folder and the .project .classpath files of each project. Want to include the JDKs? Well, you could put each of them in the SCM as individual projects and ask each developer to import and configure them. If you did this on your template workspace before distributing it, then it will have not only the JDK's but also the .metadata pointing to them.
What could go wrong with this? probably everything.
How do the pro's do it? Maven and the maven-compiler-plugin (and not committing any IDE specific files). This leaves developers free to choose any IDE they want, and most of them support automatic project configuration from POM files: target JDK, dependencies, etc.
This may not be the approach you are looking for, but one option is to use a drive letter using SUBST for the root directory of your project.
Having the same path to project on all development machines has many advantages. This strategy is most useful for developers working on a single codeline but I have successfully used it even with multiple codelines on my machine, changing the subst as necessary.
You can configure the JDK version in Eclipse. Right click your project, select properties, goto Java Compiler and there you can select a project specific version of Java for your project.
One approach would be to install all the JDKs on all the machines and use JAVA_HOME/PATH variables to point the appropriate JDK installation as required. You can write a simple batch file to take care of environment variable setting by just a simple double click.
No, that is not possible.
Either use Maven to just declare all your dependencies, including the SDK to be used. Or use Yoxos or Secure Delivery Center to centrally define Eclipse configurations, which are then deployed to your developers desk on starting Eclipse.
You're checking in the entire JDK? That seems likely to slow down your SCM quite a bit as it has to try and track a lot of large binaries, which won't diff well. Why not use a tool like Maven that declaratively states what JRE version to use?