Best practices in working with Intellij IDEA - intellij-idea

I would like to ask your advise on how to do auto build gradle project with IDEA? On eclipse I could not worry, when I add some dependency, because eclipse did everything for me, but on IDEA I need to push synchronize button.
I found this article on IDEA official site, https://www.jetbrains.com/idea/help/synchronizing-changes-in-gradle-project-and-intellij-idea-project.html
What I'm asking is how to do auto build?

One way to do is if you are using Intellij Idea 14 or later then while importing Gradle project enable auto import by enabling 'use auto-import' check box.

Try this plugin
https://plugins.jetbrains.com/plugin/?id=3822
It enables auto-make project on every save.

Related

How to check out a project from version control as a specific project type in IntelliJ IDEA?

I have a Salesforce project in GitHub that I want to check out in IntelliJ IDEA and use this as an Illuminated Cloud project. How do I do this?
I've used Eclipse with the Force.com IDE plugin before - there you can simply choose the project type and that you want to check out from the repository in one step so I think there should be a way to do this but neither me nor my colleagues are able to find it.
Any ideas?

IntelliJ clean import Hybris project

I'm trying to (re)import a hybris project in IntelliJ with the hybris integration plugin. But every time when I get to the point to select the modules there are none except the project name itself. If I try to ignore that and just press next than I end up with a project without folder / modules.
That problem came after I imported that project ones and then deleted all files that are pointed to IntelliJ.
Is it possible to clean IntelliJ from a whole project with all dependencies etc. so I can import the project like nothing happend before?
v5.4.2 required other plugins which you probably had disabled. such as spring, ant or git.
The best way to get speedy resolution on the intellij hybris plugin is from their jira support portal. Dont forget to register/login first so that you can get an answer.
https://hybris-integration.atlassian.net
Version 5.4.2 is broken. Downgrading to the older one (5.3.1) worked for me and fixed that "no modules when importing"-problem

Intellij and Hybris Tests

Currently I'm doing the hybris 5 Developer Training Trails 5.7 - Part I - Core in Intellij and the Hybris Plugin for Intellij.
Now I'm at the point where I have to run a test class. When I'm doing it, it tells me that it's not finding a a class "de.hybris.platform.cuppy.jalo.Match".
When I'm running the same test in http://localhost:9001/test then everything works fine.
I guess I have to fix my classpath, but I don't know how. If I change the classpath of the module in "Run/Debug Configurations" to something else, then it's not working. If I change there the working directory from MODULES_DIR to the whole project path it's not working either. Now I have no ideas anymore.
Just install "Hybris Integration" plugin it will do everything automatically. You will be able to import Hybris projects just like maven or gradle based projects. That plugin provides Hybris integration into Intellij IDEA and another IDE based on it.
You can install it to your IDE directly from the repository by clicking on the "Browse Repositories" button in Settings/Plugins dialog.
You need to remove all your JAVA Build Path Problems. Then test cases should work.
In my case I had set the "power save mode" on IntelliJ. Removing it solved the problem for testing

Cannot add framework support in IntelliJ 14 Ultimate

I found a pretty old post with this question but unfortunately he didn't get any help. I hope someone can assist me.
I created a repo at GitHub. After cloning it to my computer I tried to add the following framework support: Maven, JSF, EJB, CDI, etc. I know I could add the files manually. But, I want to use what the IDE has to offer.
However, the only framework showing up is SQL, which is different from this post from stackoverflow and from their documentation.
Has anyone had this same problem and got it working?
Intellij reacts to changes in your Maven pom.xml file. Maven does not react to changes in your IntelliJ project module settings.
The steps that you should follow here are
Close IntelliJ
In a command shell, clone your Github repository.
Using an editor external to IntelliJ such as VI or Notepad, create a pom.xml in the root directory. Better yet, use a Maven Archetype to generate your pom.xml.
Now open IntelliJ. Choose File, New, Project From Existing Sources. Navigate to your pom.xml and follow the prompts.
I recommend checking Search for projects recursively and Import Maven projects automatically.
Finish the project creation.
Now, add dependencies to your pom.xml via the dependencies tag. See Maven Dependencies. Intellij will automatically react to dependencies that you add as long as it can see a Maven Repository on your local machine or on your network or on the Internet.
I know it is a little bit to late but I just post it because it is still an possible issue: You need to open YourProjectName.iml and make sure that the type (<module type="JAVA_MODULE" version="4">) is JAVA_MODULE and not something else!(In my case it was WEB_MODULE)

How to use an existing Gradle project in IntelliJ IDEA 13/14

I am using Gradle and IntelliJ IDEA. Normally I use apply plugin: 'idea' to generate the IDEA project files. With IDEA 12 I was used to work with the JetGradle tool view.
Now I updated to IDEA 13 and the JetGradle tool view is gone. When I use the old run configuration gradle:run, IDEA tells me:
Error running gradle:run:
Module 'X' is not backed by gradle.
How can I activate the gradle build in IDEA 13 without the tool view? I found this tweet from Cédric Champeau, but was still not able to solve it. Do I have to turn my simple gradle project into a multi module project or what?
Update
With File - Import Project ... I can import the build.gradle file and than I can choose View - Tool Windows - Gradle, which was hidden before. Is this the way to go?
What you state in your update is the correct way to go. The Gradle Plug-in received a lot of love in the IDEA 13 update and has changed a bit. An import of the Gradle build file is necessary. And as you have noted, the JetGradle tool window is now named simple Gradle
Tested with Gradle 1.9. In my opinion there are 2 issues:
Issue 1: when using gradlew idea I expect to receive a valid IDEA project without the need to import it. There are discussions on the gradle forum, see this Gradle forum post. In this Jetbrains forum post it is told that there is no backward compatibility with IntelliJ 12 gradle projects at the moment.
Issue 2: With IDEA 12 it was possible to open the JetGradle View even if the current project was not a gradle projcet. But the view displayed the message "There is no linked Gradle project. You can Add one" and offered you the possibility to convert the project to an gradle project with a simple click. In IDEA 13 it is not possible to open the Gradle View when the current project is not a gradle project. I asked a question here.
In the Gradle forum post mentioned above Peter Niederweiser stated:
The preferred way of integrating with IDEA 13 is to use IDEA's Gradle import, without running gradle idea. (You should still apply the idea plugin though, and it's still important to apply it to allprojects {} rather than subprojects {} when dealing with multi-project builds.)
So the answer from Mark Vedder is correct, altough I would have liked to have more information.
I have found that when you initially import a gradle project into Idea, if you don't have all of your directories created yet, the gradle tool window vanishes while you are importing into Idea. (It is there when the import starts, but at the end it disappears.) However, if I manually build the project first (on a mac, >gradle clean build), and then go back to IDEA and import the project, the gradle tool window stays active. Hopefully this will help someone else.
you can go to Project Structure (Ctrl + Alt + Shift +S) and then under the Modules, click "Import Module" and choose your build.gradle from the project file repo. It will make the module gradle aware and then you will also see the Gradle window
The simplest way to do this is to use the Import Project option if you cannot use the gradlew idea to produce the idea project