build.gradle

How to create gradle task which always runs?

南笙酒味 提交于 2019-12-21 03:38:13
问题 I'm likely overlooking something pretty core/obvious, but how can I create a task that will always be executed for every task/target? I can do something like: task someTask << { println "I sometimes run" } println "I always run" But it would be much more desirable to have the always running part in a task. The closest I've come is: task someTask << { println "I sometimes run" } println "I always run" void helloThing() { println "I always run too. Hello?" } helloThing() So, using a method is

Compiling a project with different java source compatibility

怎甘沉沦 提交于 2019-12-21 01:59:15
问题 I have a multiproject configuration with 3 different projects. 2 of the projects depend on the 3rd project, which I named 'core'. Depending on the project, 'core' has to compile to a jar, with source compatibility for 1.4 and 1.6 respectively, into outputs core-1.4.jar and core-1.6.jar. Is it possible to do this with a single build.gradle, or what would be the best way to do this? How can I specify which jar in particular in my dependencies for each of the 2 projects? 回答1: The question is

After upgrade android version getting “Duplicate class android.support.v4.app.INotificationSideChannel”

萝らか妹 提交于 2019-12-20 20:20:07
问题 before android update 3.4 my application run perfectly but after upgrade android my application getting merging error: "Duplicate class android.support.v4.app.INotificationSideChannel" android update 3.4 upgrade gradle 5.1.1 upgrade sdk Error: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.app.INotificationSideChannel$Stub

Splitting all output directories in Gradle

吃可爱长大的小学妹 提交于 2019-12-20 11:05:13
问题 Gradle 4.0 came out yesterday and I updated my project for it. Now I am getting the following warning: Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0 I would like to use separate output directories for each language. What do I need to change to make that happen? Things I tried: gradle clean followed by gradle build

Android plugin 1.3 error

笑着哭i 提交于 2019-12-20 10:25:36
问题 This is error I got when updated my SDK and Build tool to Android M Android Build Tools Found incompatible Build Tools and Android plugin versions: * Module 'app' is using Android plugin 1.2.3 and Build Tools 23.0.0 rc1 Please use Android plugin 1.3 or newer, or an older Build Tools version. Otherwise the project won't build. when classpath 'com.android.tools.build:gradle:1.2.3' changed to 1.3 I got another error. Error:Could not find com.android.tools.build:gradle:1.3. Searched in the

gradle execute task after build

非 Y 不嫁゛ 提交于 2019-12-20 10:22:36
问题 I am building my project with gradle, with the following build.gradle file: project('a'){ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'application' buildDir = 'build' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' repositories { mavenCentral() } dependencies { compile 'org.slf4j:slf4j-api:1.7.7' } } When I input the gradle build command, I want gradle to execute a task after the build. I found a mustRunAfter on the Internet, and I have tried a variety of ways but

How do I extend gradle's clean task to delete a file?

一笑奈何 提交于 2019-12-20 10:21:13
问题 So far i've added the following to my build.gradle apply plugin: 'base' clean << { delete '${rootDir}/api-library/auto-generated-classes/' println '${rootDir}/api-library/auto-generated-classes/' } However not only is my file not deleted, but the print statement shows that ${rootDir} is not being converted to the root directory of my project. Why won't this work, what concepts am I missing? 回答1: You just need to use double quotes. Also, drop the << and use doFirst instead if you are planning

IntelliJ IDEA and Gradle - Cannot be applied to '(groovy.lang.Closure)'

余生颓废 提交于 2019-12-20 10:15:03
问题 I have a Gradle file which, whenever I load open it in IntelliJ IDEA 14.1.5, shows IDE errors for the entire file. Namely all the errors seem to be either: java.lang.String errors or groovy.lang.Closure errors I've tried clearing the file's contents and only writing the top line: group 'com.me.blah' but even that results in an error. For context's sake - this is an individual module in a larger SpringBoot project. This module is a set of simple static files (with Gradle for CSS compilation,

Error: Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25 in Ionic 3

人盡茶涼 提交于 2019-12-20 08:31:12
问题 I am getting the following error suddenly while building Ionic 3 app for Android. Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25 We have one solution from Android Studio here but after I did change in my build.gradle with the following code I am still getting the error. buildscript { repositories { ... maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } } allprojects { repositories { ... maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } } } My build.gradle

Getting Gradle dependencies in IntelliJ IDEA using Gradle build

a 夏天 提交于 2019-12-20 08:24:02
问题 Grade build, even from inside IntelliJ IDEA does not put the dependencies into the "External Libraries" folder, so these classes don't show up as suggestions in the editor and when I manually add them as an import there is a compile error. How can I get IntelliJ to automatically incorporate the dependencies in my build.gradle file, for instance: compile 'com.google.code.gson:gson:1.7.2 回答1: You either need to import the project as a Gradle project from within Idea. When you add a dependency