How to setup project based environment variable for IntelliJ IDEA? - intellij-idea

I do have a MAVEN based java project that requires some environment variables.
So far, I used a setenv bash script to setup them and added few other scripts in the project root to call it and do build, test...
The question is how can make this work with IntelliJ IDEA?

Not supported yet, please vote for this feature.

Related

How to define IDEA JDKs from environment variables?

We have a preexisting developer kit which contains a variety of different JDKs we need because of reasons. This kit defines environment variables such as JDK_7 and JDK_8 pointing to the appropriate directories. These paths are stable inside the kit but are not stable between developer's and build automation machines. The build scripts we use for build automation rely on these variables to set the appropriate JDK in each case. Gradle recently introduced support for detecting toolchains from environment variables, which we are using with great success.
We are now evaluating using IntelliJ IDEA as an IDE for our projects, motivated by its great Gradle support. How can we configure IDEA with JDKs from environment variables?
It is acceptable for us to create a custom plugin to adapt IDEA to our developer kits. What extensions points can we use to inject JDKs into IDEA's platform or project settings?
IDE resolves the JVM for Gradle using below algorithm:
Checks the gradle.properties file for the appropriate Gradle JVM specified in org.gradle.java.home and uses it for the project.
Then it checks the JAVA_HOME environment variable.
Then it checks the closest appropriate JDK version for the existing Gradle version.
There are related requests:
IDEA-240044 Path Variable for the default project JDK
IDEA-151340 Allow path variables to reference environment variables

How do I get the Rust IntelliJ IDEA plugin to show autocomplete suggestions?

I use IntelliJ IDEA to develop in Rust, but after installing the Rust plugin, the code auto-complete function doesn't work:
I hope IntelliJ IDEA would give me a hint for String, but I still need me to write it myself. Did I miss something?
mkaput gives the right answer:
You have created a project in a directory which is not a Cargo project (you have two separate ones inside instead). Our requirement for almost any feature is that IntelliJ project root (~/rust in your situation) is also Cargo project/workspace root (it has Cargo.toml). Thanks to this we can firmly invoke cargo to get all information we need.
tl;dr make separate projects inside each: hello_cargo and guessing_game :-)
I use IntelliJ Community Edition on MacOS and auto complete works fine. Try install racer crate and restart IDE:
cargo install racer

IntelliJ IDEA: Unable to create a Gradle project

I'm facing difficulties in setting up a gradle project. During setting up of the Gradle settings in the wizard,
I am not able to use the default recommended gradle wrapper because it downloads the Gradle and the network connectivity is very bad. So I go with the local gradle distribution which I have installed in my Ubuntu. On refreshing of the gradle project after creation, I always get stuck to this error. When I run the gradle build command through the terminal on the empty project, It works fine.
I have also tried the troubleshooting solutions given by the IDE. But, that made no improvements. Need assistance to solve this problem.
Comment if any additional info required.
As no-one else has chipped in, an approach that should work is to use the Gradle Idea Plugin instead of relying on the build in support Gradle in Idea. In my experience the plugin supports a wider range of Gradle project structures than Ideasupports directly. So you would
Create a Gradle project outside Idea and confirm it all works on from the command line.
Add the Idea plugin to the project
Run 'gradle cleanIdea idea' to generate the Idea project files.
Open up the newly generated project files from Idea and off you go.

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

How well does m2eclipse deal with maven plugins?

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.