gradle

Setting IntelliJ compiler args in Gradle

随声附和 提交于 2021-02-18 21:58:44
问题 I need to add the -parameters java compiler parameter for my tests to succeed. I can do this in gradle already for ./gradlew build to work, or manually by adding -parameters under IntelliJ Settings > Build.. > Compiler > Java Compiler > Additional command line parameters: so they work in the IDE, but I don't want everyone who checks out this repo to have to do a manual step. My .ipr file does show <component name="JavacSettings"> <option name="ADDITIONAL_OPTIONS_STRING" value="-parameters" />

Gradle buildSrc and buildscript

谁说我不能喝 提交于 2021-02-18 20:56:13
问题 We have a Gradle build that includes a buildSrc with some custom plugins. Those plugins apply yet other plugins. For example, our plugin applies com.android.tools.build:gradle . For annotation processing that library needs to be on Gradle's classpath during compilation. So, putting this in our main build.gradle works: buildscript { repositories { google() } dependencies { classpath "com.android.tools.build:gradle:$gToolsVersion" } } However, that means that for a user to apply this plugin

No Cached Version Gradle Plugin Available for offline mode

核能气质少年 提交于 2021-02-18 17:43:06
问题 I haven't used Android Studio in a while, but decided to update everything and create a new project and I get the above error, if I go to Preferences -> Build, Execution, Deployment -> Gradle. There's no option to 'Work Offline' as suggested here among other places No cached version of gradle available for offline mode I've also used the 'Command Shift A' and searched for 'Offline' and I get nothing. Anyway to disable this? 回答1: As per the Android Studio 3.6 release notes: To enable or

How to override a gradle build with dev/prod configuration

我怕爱的太早我们不能终老 提交于 2021-02-18 17:00:21
问题 I'm evaluating gradle for replacing an ant build script and I can't manage to find a solution for creating a standard build script that correctly manages dev / prod environment. Than ant script (it's for a java project, not android) is structured in this way: a common script with the standard tasks (compile, build-jar, build-war) a specific project script that includes the first one and through some properties it defines where the war task should pick the correct files Our project structure

How to emulate Android's productFlavors in a pure java gradle module?

北城余情 提交于 2021-02-18 12:28:15
问题 I need three flavors: fake staging prod fake will provide classes like FakeUser , FakeUserDb - it's very important that these classes are not compiled into the prod flavor. prod and staging are completely identical, except that I need to compile a different String url into prod vs staging . So, I need to create an "abstract" real flavor that both prod and staging inherit. This can be easily done with the android gradle plugin, but how can I do it in a pure java gradle module? 回答1: For each

How to emulate Android's productFlavors in a pure java gradle module?

喜你入骨 提交于 2021-02-18 12:28:12
问题 I need three flavors: fake staging prod fake will provide classes like FakeUser , FakeUserDb - it's very important that these classes are not compiled into the prod flavor. prod and staging are completely identical, except that I need to compile a different String url into prod vs staging . So, I need to create an "abstract" real flavor that both prod and staging inherit. This can be easily done with the android gradle plugin, but how can I do it in a pure java gradle module? 回答1: For each

Version ranges in gradle

扶醉桌前 提交于 2021-02-18 10:01:33
问题 What are the possible ways of specifying version ranges in gradle dependencies? I saw some 1.+ notation but I have not found a document which really says what is possible and what is not. Furthermore, I do not know whether the Maven ranges can be used as well. Can somebody give me a short overview so that I can understand the rules? 回答1: The book "Gradle Dependency Management" states on p. 12 and 13 that, in addition to the +-notation (2.1.+ means the range from 2.1.0 inclusive to 2.2.0

Version ranges in gradle

不想你离开。 提交于 2021-02-18 09:59:30
问题 What are the possible ways of specifying version ranges in gradle dependencies? I saw some 1.+ notation but I have not found a document which really says what is possible and what is not. Furthermore, I do not know whether the Maven ranges can be used as well. Can somebody give me a short overview so that I can understand the rules? 回答1: The book "Gradle Dependency Management" states on p. 12 and 13 that, in addition to the +-notation (2.1.+ means the range from 2.1.0 inclusive to 2.2.0

Mixing Java And Kotlin In Gradle Project, Kotlin Cannot Find Java Class

时光总嘲笑我的痴心妄想 提交于 2021-02-18 04:54:05
问题 As the title says, I am trying to mix Java and Kotlin in a single project. There's a good example found here. mixed-java-kotlin-hello-world. Everything is working properly besides kotlin cannot find any of my Java classes which are found in src/main/java/somepackage/SomeClass.java What would be the cause of this? This is the error I am getting. When I try to edit my build.gradle, it shows I'm not spelling kotlin correctly and giving me errors on plugin but I'm copying and pasting from kotlins

Mixing Java And Kotlin In Gradle Project, Kotlin Cannot Find Java Class

我是研究僧i 提交于 2021-02-18 04:52:13
问题 As the title says, I am trying to mix Java and Kotlin in a single project. There's a good example found here. mixed-java-kotlin-hello-world. Everything is working properly besides kotlin cannot find any of my Java classes which are found in src/main/java/somepackage/SomeClass.java What would be the cause of this? This is the error I am getting. When I try to edit my build.gradle, it shows I'm not spelling kotlin correctly and giving me errors on plugin but I'm copying and pasting from kotlins