Adding sources for IntelliJ plugin via Gradle - gradle

I've setup an IntelliJ plugin using Gradle. My build.gradle file contains:
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.3.12'
}
//...
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
intellij {
version '2018.2.4'
plugins 'git4idea'
}
Is there any way how I can include/download the sources of the Git4Idea plugin to the project so that they are available automatically?

No, you can't. It'a bug. I filed it here on the plugin's issue tracker.

Related

Starting with IntelliJ and Gradle : how to do jUnit tests?

Good evening,
because I want to initiate myself to LibGDX, I recently gave a try to IntelliJ Idea IDE and Gradle instead of my old Eclipse-Maven habits.
I have to recognize that such a change is not easy because I really don't find anything.
To start learning I created a project with a simple Pojo and also a unit test class.
I have no error in the editor, both Pojo and jUnit seem OK, but when I launch the unit test, I get such errors :
Can someone help me understand what's going wrong ?
EDIT : build.gradle file content :
plugins {
id 'java'
}
group 'com.citizenweb.training'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
// https://mvnrepository.com/artifact/org.projectlombok/lombok
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.16'
}
Thanx by advance.
It seems you did not configure lombok dependencies properly: your test classes cannot see lombok-generated stuff (getters, setters, build). Lombok is based on annotation processor so you need to declare following dependencies in your build.gradle :
ext {
lombokVersion = "1.18.6"
}
dependencies {
// Lombok
compileOnly ("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor ("org.projectlombok:lombok:${lombokVersion}")
// to make lombok available for test classes
testCompileOnly ("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor ("org.projectlombok:lombok:${lombokVersion}")
testImplementation("junit:junit:4.12")
}

How to Package a JavaFX Application as a standalone executable EXE using Gradle

I recently downloaded the JavaFX 12 SDK and started a Gradle Application in IntelliJ IDE.I have also imported all the necessary dependencies in the build.gradle file. Now I want to package the final JavaFX application as a standalone executable exe file that can be clicked and run on Windows. How can I do this since I started the project as a Gradle Project. The Build Artifact Menu Item on IntelliJ seems to be permanently disabled.
Here is a setup of my build.gradle file
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
javafx {
version = "12.0.1"
modules = ['javafx.base', 'javafx.controls', 'javafx.web']
}
group 'condo'
version '1'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
mainClassName = 'rumbler.launcher.ApplicationLoader'
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.iq80.leveldb', name: 'leveldb', version: '0.12'
implementation 'org.controlsfx:controlsfx:11.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation group: 'org.json', name: 'json', version: '20180813'
}
Thanks alot.

Can I remove the 'jar' task in gradle build?

When I use the code below, a file of jar will generate after gradle build.
apply plugin 'java'
Is there any settings won't generate the file of jar??
I can write a custom plugins,but the code below was wrong.
dependencies {
compile project(':crm.common')
testCompile group: 'junit', name: 'junit', version: '4.12'
}
I want find a way that donot generate the file of jar.
And can run compile in dependencies.
Is there any way can do that???
You can do that by 2 ways:
explicitly exclude the jar task from execution:
gradle build -x jar
disable the jar task in build.gradle:
apply plugin: 'java'
jar.enabled = false
This worked for me:
configurations.archives.with {
artifacts.remove artifacts.find { it.toString().contains("jar") }
}

How to download Griffon distribution in Intellij Gradle project?

I am trying to start a Griffon project. The Griffon repository is available from bintray. I created a Gradle project in Intellij and added the maven repository provided into the build.gradle file. But the project structure is not being generated. I need to know how create a Griffon project in Intellij correctly. I am adding the code from the build.gradle file that i edited.
apply plugin: 'java'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/griffon/griffon"
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
Please follow the instructions found at http://griffon-framework.org/ and http://griffon-framework.org/tutorials/1_getting_started.html.
Note that IntelliJ includes a Griffon plugin that works with Griffon 1.x but does not work with Griffon 2.x. Griffon 2 can be opened/imported as a normal Gradle or Maven project.

Confused with Gradle Dependencies

I am trying to add my dependencies to Gradle Dependencies library in eclipse, and when I run this, it downloads these dependencies, however my other dependencies are in the Gradle Dependencies folder under Gradle Project in eclipse but this one is not. Please help, I just need to add a Gradle Dependency in eclipse.
repositories {
mavenCentral()
maven {
url "http://clojars.org/repo"
}
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
compile "org.clojars.jmeeks:jfugue-with-musicxml:4.0.3"
testCompile group: 'junit', name: 'junit', version: '4.+'
}
You should tell to gradle about your local repository adding mavenLocal() first in repositories section. Using your current configuration you are telling to gradle that everything is stored in mavenCentral or the custom repo.

Resources