gradlew clean deployNodes - QUASAR WARNING: Quasar Java Agent isn't running - intellij-idea

When I run "gradlew clean deployNodes" or "gradlew deployNodes", I get a warning on Quasar library:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using another instrumentation method you can ignore this message; otherwise, please refer to the Getting
Started section in the Quasar documentation.
How can i fix this warning ?
I upgraded Corda to 4.1

you'll want to double-check the intellij settings.
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
As mentioned in the comments from manish, make sure to try cleaning the gradle cache as well: ./gradlew clean build deployNodes.
Joel has a good answer for a similar quasar issue on this StackOverflow question: Error when running Corda flow tests from IntelliJ

Related

Gradle tasks are not visible in new version of Android Studio

I have a project made with Android Studio 3.0 with coworkers. There are so many Tasks for installing the application. After I finished updating the Android Studio from 3.0 to 3.3.2, almost tasks in project(root)>tasks are not visible. Checkout my gradle project below.
3.0 :
my-project
ㄴmy-project (root)
ㄴTasks
ㄴandroid
ㄴbuild
ㄴbuild setup
ㄴhelp
ㄴinstall
ㄴother
ㄴverification
ㄴmy-module-one
ㄴTasks
ㄴandroid
ㄴbuild
ㄴhelp
ㄴinstall
ㄴother
ㄴverification
ㄴmy-module-two
...
3.3.2 :
my-project
ㄴmy-project (root)
ㄴTasks
ㄴbuild setup
ㄴhelp
ㄴother
ㄴmy-module-one
ㄴTasks
ㄴandroid
ㄴbuild
ㄴcleanup
ㄴhelp
ㄴinstall
ㄴother
ㄴverification
ㄴmy-module-two
...
I can check some tasks are not visible and suddenly the "cleanup" thing appears in every modules. How can i solve it and What's the reason of these problems.
Had the same problem: after import from GitHub there weren't any Gradle tasks in Android Studio. Spent hours on solving this issue but nothing helped. Only these steps solved problem in my case:
In Android Studio go to File -> Settings... -> Experimental and uncheck the Do not build Gradle task list during Gradle build checkbox.
Delete cloned project and clone it again (if some of required files like keystore properties are not present, add them and do File -> Invalidate Caches / Restart).
Android Studio 4.2 has a new experimental feature for Gradle, which is Do not build Gradle task list during Gradle sync. Unfortunately, it comes checked (on) by default, and results in the Gradle task list not being visible in the Gradle view. This because the Gradle task list is not even being generated. However, it leaves many of us wondering what happened to the Gradle task list.
You can go to Settings (e.g., File -> Settings on windows, Preferences -> Settings on mac) and go to Experimental. There you can uncheck the new option.
Then just click on Sync Project with Gradle Files and the Gradle task list will be generated and visible again.
Accroding to this link
Behavior changes:
Lazy task configuration: The plugin now uses Gradle’s new task creation API to avoid initializing and configuring tasks that are not required to complete the current build (or tasks not on the execution task graph). For example, if you have multiple build variants, such as “release” and “debug” build variants, and you're building the “debug” version of your app, the plugin avoids initializing and configuring tasks for the “release” version of your app.
Calling certain older methods in the Variants API, such as variant.getJavaCompile(), might still force task configuration. To make sure that your build is optimized for lazy task configuration, invoke new methods that instead return a TaskProvider object, such as variant.getJavaCompileProvider().
If you execute custom build tasks, learn how to adapt to Gradle’s new task-creation API.

Intellij IDEA gradle debug plugin

Using IDEA 2017.1(ue); I like to know how I can debug a gradle plugin. I've setup a very simple gradle project (https://github.com/tkvw/gradle-plugin-debug). The project references one plugin org.gradle.hello-world.
My questions are:
1) Where can I set a breakpoint on the helloworld plugin? Normally I lookup my classes/sources using search anywhere in IDEA, but it doesn't find the class/sources. Idea seems to ignore the buildscript dependencies of the gradle build in it's sources lookup path?. (I tried the "old" buildscript block + apply as well)
2) How do I setup -Dorg.gradle.debug=true on the run configuration? If I specify it like this: the task simply runs and doesn't wait for a debugger to be attached.
From the command prompt the command
gradlew -Dorg.gradle.debug=true helloworld
does run and wait for a debugger to connect.

IDEA 2016.1, Gradle's processResources expanding not working automatically

I have an IDEA 2016.1 Enterprise and a Gradle 2.12 multi-module project. In one of the modules, in src/main/resources, I have a file which I would like Gradle to 'expand', here is my configuration:
processResources {
filesMatching('my.properties') {
expand(project.properties)
}
}
(I would like to expand just this single file, and just copy the rest.)
It all works fine when built on the command line, but not by default in IDEA - when I clean and build the project, the file lands in build/resources/main but the placeholders are not replaced. I have to manually invoke the Gradle processResources task using the Gradle pane in IDEA and double clicking on the task.
Is this something I should report to Jetbrains (i.e. a bug) or has anybody have it working and I should change something in my configuration?
When you build from command line, you are using gradle. However, when you build the project from intellij, by default intellij doesn't use gradle to build, but use its internal build system which doesn't understand your gradle's processResources.
One way to solve it is to check "Delegate IDE build/run actions to gradle" as shown below:
If you don't want to use gradle build in intellij, there's another workaround - add processResources as a gradle task to run after build in your "Run/Debug Configurations":
Try adding the dependency in your build.gradle file, eg.
assemble.dependsOn processResources
This should work if you have java plugin applied.

Code analysis for android projects in Teamcity

I have a gradle based android studio project. I have installed IntelliJ IDEA 14 CE . Now I want to check code quality using a command. Is this possible? The real question is whether you can do code analysis to a completed project using IntelliJ IDEA 14 CE. Please give a solution.
EDIT
If it's not possible is there any other tool available for code analysis which can be operated using a shell command. I require command based code checking which will make my job easier when I integrate a project with the continuous integration server(TeamCity).
Lint is a very good option for code inspection. Just do the following
cd PATH_TO_PROJECT
chmod a+x gradlew
./gradlew lint
To avoid warnings from failing the build edit build.gradle file as below
android {
lintOptions {
quiet false
abortOnError true
ignoreWarnings true
checkReleaseBuilds false
}
...
}
The errors will be obtained as an html and xml file in your output folder
TeamCity has direct integration with IntelliJ IDEA inspections. If you check in your IntelliJ IDEA project into the version control system, you can add the "Inspections (IntelliJ IDEA)" build runner to your build configuration, and it will run the inspections without requiring you to set up the command line manually. See the documentation for more information.
You can use detekt which generates checkstyle formatted xml that can be parsed by TeamCity.
https://github.com/detekt/detekt

How to define Gradle's home in IDEA?

I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid location - I have the GRADLE_USER_HOME environment variable set (to what I think is!) the correct path, and I have been able to successfully import this same project into Eclipse. Any suggestions?
You can write a simple gradle script to print your GRADLE_HOME directory.
task getHomeDir {
doLast {
println gradle.gradleHomeDir
}
}
and name it build.gradle.
Then run it with:
gradle getHomeDir
If you installed with homebrew, use brew info gradle to find the base path (i.e. /usr/local/Cellar/gradle/1.10/), and just append libexec.
The same task in Kotlin in case you use build.gradle.kts:
tasks.register("getHomeDir") {
println("Gradle home dir: ${gradle.gradleHomeDir}")
}
Installed on a Mac via Homebrew, the path
/usr/local/opt/gradle/libexec
is preferable to
/usr/local/Cellar/gradle/X.X/libexec
since the former will survive version upgrades.
If you installed gradle with homebrew, then the path is:
/usr/local/Cellar/gradle/X.X/libexec
Where X.X is the version of gradle (currently 2.1)
If you are using IntelliJ, just do the following.
Close the project
(re)Open the project
you will see "Import gradle project" message on the right bottom. click.
select "Use default gradle wrapper". not "Use local gradle distribution"
That's all.
This is what helped me solve the problem of not having Gradle home set for the IDEA when importing a Gradle project.
THREE OPTIONS -- (A) Default Wrapper (B) "gradle 'wrapper' task configuration" OR (C) "local gradle distribution" defined by jetbrains: https://www.jetbrains.com/help/idea/gradle-settings.html
A. Default Wrapper (recommended)
If you are able, select this recommended option. If it is grayed out, see option C, which should then set your default for all subsequent projects.
B. Gradle 'Wrapper' Task Configuration
If you want IDEA to define your gradle version for you from your build script
Set this option if you define your gradle build versions as a task within your actual gradle build.
Example below from jetbrains: https://www.jetbrains.com/help/idea/gradle-settings.html
(useful if you do not want to share gradle builds between projects)
C. Local Gradle Distribution
1. Run the following command to get gradle location:
brew info gradle (if gradle was installed with homebrew)
2. You are looking for something like this:
/usr/local/Cellar/gradle/4.8.1
3. Next, append 'libexec' to the gradle location you just found:
/usr/local/Cellar/gradle/4.8.1/libexec
This is because "libexec is to be used by other daemons and system utilities executed by other programs" (i.e. IDEA). Please see https://unix.stackexchange.com/questions/312146/what-is-the-purpose-of-usr-libexec
4. Finally, put that new path in the Gradle home input box if IDEA prompts you.
IDEA should now have allowed you to hit OK
C:\Users\<_username>\.gradle\wrapper\dists\gradle-<_version>-all\<_number_random_maybe>\gradle-<_version>
\Android studio\gradle didn't worked for me.
And "Default gradle wrapper" wasn't configured while importing (cloning) the project from bitbucket
If it causes problem to figure out the path, here is my path :
C:\Users\prabs\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1
This is instruction for MAC only.
I had the same problem. I solved it by configuring $GRADLE_HOME in .bash_profile. Here's how you do it:
Open .bash_profile (usually it's located in the user’s home directory).
Add the following lines to update $PATH variable:
export GRADLE_HOME=/usr/local/opt/gradle/libexec
export PATH=$GRADLE_HOME/bin:$PATH
Save it.
Apply your changes by running
source .bash_profile
I wrote my own article with instruction in a case if somebody will encounter the same problem.
On a mac it should ideally be at : /Applications/Android Studio.app/Contents/gradle/gradle-2.14.1
(Replace the version string with the latest)
AFAIK it is GRADLE_HOME not GRADLE_USER_HOME (see gradle installation http://www.gradle.org/installation).
On the other hand I played a bit with Gradle support in Idea 13 Cardea and I think the gradle home is not automatically discover by Idea. If so you can file a issue in youtrack.
Also, if you use gradle 1.6+ you can use the Graldle support for setting the build and wrapper. I think idea automatically discover the wrapper based gradle project.
$ gradle setupBuild --type java-library
$ gradle wrapper
Note: Supported library types: basic, maven, java
Regards
If you're using MacPorts, the path is
/opt/local/share/java/gradle
I had to setup the Project SDK before selecting gradle path. Once that was set correctly, I had to choose "Use default gradle wrapper (recommended) in "Import Project from Gradle" dialog.
Still works if I remove gradle using brew:
$ brew remove gradle
This is where my gradle home is (Arch Linux):
/usr/share/java/gradle/
I had some weird errors where it could not find my class, I had to right click on my src folder (was red) to "Make Directory as" -> Source Folder Root
Click New -> Project from existing sources -> Import gradle project...
Then Idea recognized gradle automatically.
I couldn't get it to accept my Gradle JVM selection until I deleted a broken JDK
Th window below is from File -> Other Settings -> Structure For New Projects...
I had a red 1.8 JDK SDK entry here, once I deleted that Gradle JVM error below disappeared and I could move on to the next step
In case you are using Mac, most probably your gradle home should be /usr/local/gradle-2.0 for example.
In preference of IDEA search for gradle and set gradle home as given above.
It should work