Netbeans + Eclipse + Dart -> IntelliJ - intellij-idea

At the moment I have 3 IDEs running at the same time, Netbeans for PHP and Python related projects (support for both are poor in Netbeans), Eclipse STS for Java/Spring/Scala projects (STS hangs when the projects get too big) and Dart IDE for Dart projects.
I'm trying out IntelliJ seeing as it has decent support for all the languages I'm working in and somehow it's a lot more stable, much faster, much more intuitive, but I can't figure out how to import multiple projects ... (that's something that just works in both Netbeans and Eclipse)
... there's a Maven Projects tab on the right, if I click the + sign it perfectly imports multiple maven projects for me and lists them in the project box, as soon as I import a non-maven project using file -> import project, all my other projects disappear and I have to re-import those projects via the Maven Projects tab. If I import a non-maven project first and then the maven projects using the Maven Projects tab on the right, I can mix one Dart project and multiple maven projects.
The suggestion out there is to import them as modules under a project, so I create an empty new project called Workspace, I select JDK 1.7 for the project SDK. Under module I click the + sign, find my project, select the pom.xml, add all the pom.xml files for that project and click ok - now I have a project with multiple modules.
Repeat for another project, import all the modules, and first project disappears.
How do I have multiple projects with their own "modules" (modules which are actually standalone projects) in IntelliJ. If projects are the eclipse equivalent of workspaces, is it possible to have multiple workspaces open? If not, how do I switch between them? (if switching is too much hassle, I'll create one mega-project and just add all projects as modules)

You can have multiple projects open in separate IntelliJ windows. Every time you open or create a project, or open a build file such as pom.xml or build.gradle, IntelliJ asks you whether you want to open the project in the same window or a new one.

Related

How can I add gradle support to an existing intellij project?

I have an intellij project that has gradle files in it(build.gradle, settings.gradle, etc.) and I have the project working in intellij. The issue is that intellij can't find any 3rd party libraries so I need to link the gradle project to it. How can I do this to an existing intellij project or at least be able to resolve 3rd party libraries so that the classes don't show up as red in the editor?
I'm on version 2016.1.2 145.972
You can click on the "+" symbol on the Gradle tool window and attach the project. If you don't see the window, use View | Tool Windows | Gradle to bring it up. (Or use the square icon on bottom left). You may then have to click the refresh icon to bring in the dependancies (in case IntelliJ didn't do it).
Refer: https://www.jetbrains.com/help/idea/2016.1/working-with-gradle-projects.html
Alternately, you could just re-import the project freshly using gradle.
Import Existing Project -> Import project from External model -> Gradle

Getting contents and natures of all projects in a Maven build

Currently I'm working on a Maven plugin that should generate files in all projects (OSGi bundles) that have a certain Eclipse project nature.
How can I access the contents of the projects included in the build and the project natures by using the Maven API?
Maven is a standalone build tool, not an Eclipse plugin. You cannot access Eclipse project settings from core Maven API.
Eclipse supports Maven with the M2E Eclipse plugin. It is possible to write M2E extensions and in the extension you can query the project natures via the functions of AbstractProjectConfigurator class.
However, M2E extensions will not run when you compile your code in the command line. I suggest that you choose one of the followings:
Write an Eclipse plugin that generates the source code into the src folder of the maven project. Code generation should be started by the user manually (selecting a context menu in the project or something).
Avoid using Eclipse project natures and solve your questions based on analyzing the source and pom of your project.
If you need to react on certain aspects in the source code like it looks from the thread with Balazs then you can simply write an ordinary maven plugin and include it in the parent pom. It will then run in every project and can analyze the code and react based on it.

IntelliJ IDEA with multiple gradle subprojects

I'm working on multiple Gradle projects with internal and external dependencies, and so far I am happy that thanks to Gradle's dependency management I can modify a library project without affecting every application that uses the library.
When I need to modify a library project and test it using an application project that uses it, I need to do the following,
Modify the library project and commit to SCM
Trigger CI to build the library project and push it to my Gradle repository
Update the application project's build.properties to refer to the new version of library project
Iterate the above steps until everything works and there is no bug
So it became quite combersome now. Can I configure IntelliJ IDEA so that
All my Gradle projects are in one window, like the screenshot below, which is Twitter's Finagle imported using its pom.xml. Sadly IntelliJ's JetGradle plugin doesn't seem to understand Gradle subprojects.
When build.properties's dependencies are my subprojects, read dependency from local snapshot, otherwise download them from the Gradle repository
Thanks.
If you want to open all projects in a single IDEA window, you'll have to aggregate them into a multi-project build, at least until IDEA 13 hits the market. Before IDEA 13, it's better to use Gradle's IDEA integration. Once you have a multi-project build, all you need to do is to add allprojects { apply plugin: "idea" } to the root build script, run gradle (cleanIdea) idea, then open the generated IDEA project.
Currently in IntelliJ IDEA 2019.2 you can add the gradle subprojects like so
Open Gradle Tool Window via View > Tool Windows > Gradle menu
Click on "Link Gradle Project" button (the plus sign)
Select the build.gradle file corresponding to the subproject
Go to File > Project Structure > Modules > NameOfSubproject
Navigate to main/java and click on Mark as: Sources
Mark the main/resources as Resources
Restart IntelliJ IDEA
The sources of the subproject will be recognized by IntelliJ and you can use Navigate Class action for the classes in the subproject

Why does Eclipse load all plugins in a workspace?

I'm using Eclipse 3.6 for developing Eclipse plug-in. In the same workspace, I have 2 Plug-in projects: projA and projB. No mater which project was run, both two projects will be loaded in the new Eclipse instance. If I only want to load projA, I have to close projB, why?
I run the project like this: right click the project and "Run as--- Eclipse Application".
Have you defined the target platfom?
You can also edit your Run Configuration and choose the plugins to launch with.
The way you debug your project will start a new instance of Eclipse with all existing plugins installed(in your case,both project A and B are installed).This is typically called self-hosting in PDE.
If project A has no dependent package,just close other projects.

IDEA projects, clarification needed

Using InteliJ IDEA, I am trying to set up multiple projects to run as part of the same IDE.
When import it (File->New Project->From Maven) only the latest imported project shows up.
How can i get multiple projects to appear?
As you can find in the FAQ, IntelliJ IDEA project maps to Eclipse workspace and module maps to Eclipse project.
Create one IDEA project and then add multiple modules to it. Modules can have different JDK and language level settings.