I have installed JRebel plugin for Intellij Idea and my project is running with Jetty gradle plugin.
I run my project with "Run with JRebel", project perfectly runs, but hot swap which i expected is not working.
Does anybody have an understandable and detailed instruction how to set up Jrebel for work with jetty, gradle and intellij idea?
1) You need to add JRebel Agent as a vm argument into Jetty.
Depending on your environment:
Windows 64-bit JDK jrebel64.dll
Windows 32-bit JDK jrebel32.dll
Mac OS X 64-bit JDK libjrebel64.dylib
Mac OS X 32-bit JDK libjrebel32.dylib
Linux 64-bit JDK libjrebel64.so
Linux 32-bit JDK libjrebel32.so
You need to add -agenthpath argument in gradle.properties file:
org.gradle.jvmargs=-agentpath:[c:\path\to\]lib\jrebel64.dll
2) You need to generate rebel.xml files for your projects in JRebel IDE plugin
Right-click on the project node in the Project View and select JRebel > rebel.xml. Alternatively, you can check projet in JRebel Modules window
3) You need to deploy(run) your projects into the Jetty with rebel.xml configuration files and when you make a code change in a .java file you need to generate new .class file. IntelliJ IDEA does not compile classes on save by default. Press Ctrl+Shift+F9 to compile the current file, module or package (you can also find this command via Build > Make Project).
Related
I have a IntelliJ Community Edition with Gradle 4.3.1 and com.bmuschko.tomcat plugin running. My application will be deployed currently and its working, now I want to enable JRebel for this. So that changes on my webapp folder will be hot-deployed.
At the plugin site is a description for this
Edit your Gradle startup script and add the following line to it to
tell Gradle to use the JRebel agent. Please make sure to set the
environment variable REBEL_HOME that points to your JRebel
installation directory.
JAVA_OPTS="-javaagent:$REBEL_HOME/jrebel.jar $JAVA_OPTS"
Currenty its not clear for me where do I need to change this? Obiously JRebel is not active when I start my tomcat with the pluging.
What I did:
installed the jrebel plugin in intellij
enabled the jrebel functionality with the ide
manually added a rebel.xml file (as described on the plugin site) in the build/classes/main folder
Where do I need to edit the gradle start up so that jrebel is active for gradle builds?
There are two ways you can run gradle that will affect how to add the arguments, with the daemon and without.
If you run gradle tomcatRun --no-daemon the arguments for JRebel must be added via JAVA_OPTS or GRADLE_OPTS environment variables. So this means either running as GRADLE_OPTS=-agentpath:/path/to/jrebel/lib/libjrebel64.so gradle tomcatRun --no-daemon or specifying the variable in a script(gradlew if you are using it). If you run the gradle task directly from IntelliJ, you can specify environment variables there.
If you run with the daemon, the GRADLE_OPTS variable will set JVM arguments for the launcher process, not the daemon. This will mean that JRebel is included in the wrong process and your changes aren't monitored. One way to set JVM arguments for the daemon is by adding the following to your gradle.properties
org.gradle.jvmargs='-agentpath:/path/to/jrebel/lib/libjrebel64.so'
Running with the daemon will mean that the JRebel banner is not displayed so don't be alarmed as the changes will still be monitored.
Also since JRebel 7.0 the folder structure was changed and the jrebel.jar located in installation root is the new core which requires additional bootstrapping provided by the included native agents in the jrebel/lib dir. It is suggested to use the corresponding native agent for your OS/arch using the agentpath argument and not the javaagent argument as in the tomcat plugin docs.
I'm developing an intellij plugin supposed to be used in android studio.
I've already setup the plugin development environment, but when I hit "Run" command it starts a new intellij instance with the plugin installed.
What I'm looking for is how to run the plugin directly on Android Studio, is that possibile? The only place where I think it can be configured is from "Run configurations" but I do not find anything useful there.
Thanks
You can specify the platform to run on in the IntelliJ Platform Plugin SDK settings, under Platform Settings | SDKs in the Project Structure settings. Point the IntelliJ Platform Plugin SDK home path to your Android Studio installation.
Another option is to create a new Plugin Run Configuration. In the Run Configuration it is possible to specify the JRE to run on. Click on the ... button there and select an Android Studio installation directory (e.g. /Applications/Android Studio.app/Contents on the Mac). This way it is possible to create a Run Configuration for all IntelliJ Platform IDEs you want to test your plugin on.
Each time I attempt to create a new IntelliJ 14.1.4 project on Windows with Gradle integration I receive the following error during the 'Make' command when I have any Groovy source files included in the project...
Error:Cannot compile Groovy files: no Groovy library is defined for module 'GradleCommandLine'
I have tried:
Creating a Gradle project through the new project wizard in IntelliJ, choosing Groovy as a an 'Additional Library'
Creating a new Gradle project outside of IntelliJ using the gradle init --type groovy-library command, then opening IntelliJ which finds the gradle.build file and automatically links to the project
Converting an existing project that was working with the IvyIDEA plugin to a Gradle build
I have tried adding (made sure) my groovy-all library as a 'Global Library' within the project structure
Each of these gave me the same 'Cannot compile Groovy files' error.
What does work:
I can run the gradle war command which compiles correctly and I can deploy the build war to an application server (in my case Tomcat 7.0.47)
However in watching the Getting Started with Gradle in IntelliJ IDEA 13 (they do not have one for IntelliJ 14) demo video, they are able to just run the standard 'Make' and add the unexploded war as a build artifact.
Also had a colleague using the Mac version of IntelliJ 14.1.4 do the same 'I have tried' attempts above and he did not run into any issues. They even imported the same project I was having issues with and it was able to do the 'Make' without any changes to settings.
Pointing to local Gradle installation solved issue. There was an issue with a corporate proxy preventing the Gradle distribution from installing properly.
I've got two dev workstations, one running Windows, the other running Linux. I work on a Java project using Intellij on both. Both platforms have the Oracle JDK 7 installed in the default locations.
For some annoying reason, every time I switch platforms, I need to update the project configuration to specify what JDK it should be using. In the project's "Project SDK" setting, there's a JDK selection which includes two entries - 1 for a JDK in c:\Program Files\Java\jdk_1.7 and the other for a JDK in /usr/lib/jvm/java-7-jdk/. If I open the project on Linux, I have to specifically set the Project JDK to be the second. If I save the project, close, commit, and then checkout and open on Windows, it complains it can't find the JDK, and I have to manually set it to the Windows version.
Why can't Intellij figure this out automatically? I appreciate that testing against multiple installed JDKs is a useful feature, but is there a way to tell a project to 'just use the default JDK'?
You need to have your JDK configurations to have the same name, lile 1.6 or 1.7. Project file references JDK by its name only so it will work out of the box in all IDEA installations on different operation systems, the only requirement is that there is JSDK defined under exactly the same name.
I can run gradle from a command line to see its version.
I can run, compile and debug a grails app in IntelliJ (version 10.0 or version 10.2)
I installed the IntelliJ Gradle Plugin.
Whenever I try to do anything with gradle from within Intellij I get an error as follows:
Executing command: "tasks"
Failed to connect to gradle process for command 'tasks'
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
But in my environment I have JAVA_HOME set to the proper JDK in a different directory. Plus when I look in IntelliJ for the project, it also shows the JDK in the proper JDK location. I cannot find anything that attempts to point the JDK to the Intellij JRE location.
Any ideas please?
IntelliJ uses its own jre.
to force IntelliJ to use it, you need to set the environment variable IDEA_JDK to point to your JDK.
then simply restart intellij and gradle gui plugin should now work.
Man I had so much trouble with this as well, and I don't remember having this much trouble before. I think they changed something. Here are the incantations which got it working for me on Mac OS X 10.11.5, both with Java and Gradle on IntelliJ 2016.1
Here's the summary: install the latest Java JDK from Oracle, add the java_home value to $JAVA_HOME and set that value to $IDEA_HOME (IntelliJ's variable for defining which JDK to use), install gradle (optional) using homebrew, then define the project SDK in IntelliJ.
Here it is broken down from the very beginning of a clean install:
1. Download Java from Oracle's Download Page
2. Use homebrew to install gradle
IntelliJ ships with its own version of Gradle, so this is really optional, and is helpful if you want to use Gradle outside of IntelliJ.
`brew update && brew install gradle`
3. Set the env variables
Paste the following into ~/.profile. These values will work regardless of which version of java or gradle you have installed. Don't set the GRADLE_HOME if you didn't install the standalone gradle.
export JAVA_HOME=$(/usr/libexec/java_home)
export IDEA_JDK=$JAVA_HOME
export GRADLE_HOME=/usr/local/opt/gradle/libexec
4. Set the environment variable to occur at application launch so that IntelliJ sees is using OS X's launchctl program:
launchctl setenv JAVA_HOME $(/usr/libexec/java_home)
5. Define the project SDK
Use the project settings window in IntelliJ to define the project SDK (I don't see this option anywhere else in the global IntelliJ preferences window, this has to be done in the project settings).
6. Wait for the indexes to update, then close and re-open IntelliJ. You should now be able to build the program.
if you are using Intellij version 10.x you should not install any Plugin to run a gradle script.
All you have to do is to go to the Gradle setup (File -> Settings -> Gradle) and set the Gradle Home folder (the location of your Gradle installation, eg. C:\tools\gradle).
You should be able to select a Gradle build file and run it.
Point your JAVA_HOME to JDK, not to JRE.
I think this error might be caused by an install bug with IntelliJ IDEA. When I look at the installed folder referred to in the error message on my filesystem:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
I see the jre folder but then another jre folder beneath that one which contains the bin and lib folders of the jre:
jre
jre
bin
lib
I copied bin and lib up a level into the first jre folder, and that fixed this error for me.