I'm trying to build a project, but the gradle build is stuck on compile java, I don't know how to fix it:
Gradle is actually very specific what has happened. There're compilation errors in project gene-model-dom.
Execution failed for task ':gene-model:gene-model-dom:compileJava'.
> Compilation failed; see the compiler output for details
To see the exact errors, run the build again with --info switch. For example (your mileage may vary):
gradlew --info :gene-model:gene-model-dom:compileJava
Related
We cannot see an answer to the question on whether command like ./gradlew lint is part of Android Gradle Plugin (AGP) or the Gradle itself. We are getting error when executing lint but it seems a bug with the lint itself and we are not sure if we supposedly report it on AGP or Gradle.
Logs:
Error: Unexpected failure during lint analysis of ActivityExt.kt (this is a bug in lint or one of the libraries it depends on)
No error in the code nor lint warning and this is working before the update.
The ./gradlew lint command is actually a way to invoke the lint function that is bundled as part of the Android SDK, using gradle.
So the bug with the lint tool should be reported to Android.
I do have openjfx installed (via dnf), and I believe the jar it's looking for is the one installed at the following path:
/usr/lib/jvm/openjfx/lib/ant-javafx.jar
Obviously I'd like to avoid hard-coding jar paths like that, but I haven't even found a way to use that path. Here is gradle output:
$ gradle tasks
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'testproj'.
> Couldn't find Ant-JavaFX-library, please make sure you've installed some JDK which includes JavaFX (e.g. OracleJDK or OpenJDK and OpenJFX), and JAVA_HOME is set properly.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
and gradle --version:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/travis/opt/gradle/4.9/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.9
------------------------------------------------------------
Build time: 2018-07-16 08:14:03 UTC
Revision: efcf8c1cf533b03c70f394f270f46a174c738efc
Kotlin DSL: 0.18.4
Kotlin: 1.2.41
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 10.0.2 ("Oracle Corporation" 10.0.2+13)
OS: Linux 4.18.9-200.fc28.x86_64 amd64
Seems like there isn't a good answer, except to stick with Java 8 for now.
As Some Guy mentioned in a comment, a new Gradle plugin is probably going to supercede this one at some point, but the author FibreFoX writes to "please live with the plugin in it's current state, as long as you can". That seems to mean being stuck at an old version of Java that shipped with JavaFX on the classpath.
As an aside, the problems with maintaining the plugin probably have to do with packaging, given the new java dependency DAG system; 8 is the last version that used the old classpath system.
I'd be happy to find a better answer.
We recently upgraded from Kotlin 1.1.51 to 1.2.10, cleared all the warnings (we use -Werror to treat warnings as errors), and the project is up and running. We build it from command line using mvn verify without issues, as well as from IntelliJ using Build > Build project.
Then, we decided to upgrade to the latest version (1.2.21), and here is where we are seeing some issues: when compiling the project from command line (mvn verify) a warning shows up causing the compilation to fail:
[WARNING] Classpath entry points to a non-existent location: /Users/username/git/projectname/target/classes
The interesting thing is that if we do Build > Build Project on IntelliJ, then there is no warning, and the project will compile (and run) without issues. And if we downgrade Kotlin's version to 1.2.10 on the pom file (instead of 1.2.21), it builds successfully again from both command line and IntelliJ Build.
We noticed that when we do Build > Build Project, two directories are created in the target folder: classes and test-classes; while when the command line build fails, there are two different directories: kotlin-ic and maven-status.
I saw questions that seem related (1, 2, or 3), but their errors/warnings seem specific to certain libraries while in this case it looks like something more general (it's not a particular library that I can add as a dependency as suggested on the answers).
Why is that difference between command line and IntelliJ build? What causes that warning, and how can we fix it?
I had similar problem and I got it working by disabling kotlin incremental compiler :).
<kotlin.compiler.incremental>false</kotlin.compiler.incremental>
For future readers: if you have the inverse problem (building from the command line works, but building in IntelliJ fails):
in IntelliJ, go to Project settings -> Libraries
remove all entries
rebuild the project
I am trying to run gradlew on offline machine. It starts from message
Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip
and then fails with exception.
What it wants and how to satisfy it?
Option 1. If you have possibility go online temporary
Command gradlew means you are trying to use Gradle Wrapper. It is a tool for automated downloading of Gradle distribution.
In order to download Gradle Wrapper you have to execute gradlew command with a proper network connection at least once.
Make sure you have correct network and proxy settings.
./gradlew build
Only after that you can build a project offline. Example:
./gradlew build --offline
Option 2. Download distribution by hand
Or, alternatively, you could download distribution from official site. Then extract it, add gradle to PATH variable, and run:
gradle build --offline
I download elasticsearch source code from :https://github.com/elastic/elasticsearch,
I found there is a build.gradlefile,and I have install gradle,
how to build source it?
There is a description fo the way you can build it in the readme file in the repo. According to it:
Building from Source
Elasticsearch uses Gradle for its build system. You’ll need to have
version 2.13 of Gradle installed.
In order to create a distribution, simply run the gradle assemble
command in the cloned directory.
The distribution for each project will be created under the
build/distributions directory in that project.
See the TESTING file for more information about running the
Elasticsearch test suite.
So all you need is to get into the root directory and in command line call gradle assemble, if you have Gradle installed properly, you will find all artifacts under build/distributions directory
gradle assemble seems to yield some errors such as cannot find symbol in my macOS environment.
According to the latest description in the repo (as of time writing the answer):
To build a distribution for your local OS and print its output location upon completion, run:
./gradlew localDistro
To build a distribution for another platform, run the related command:
./gradlew :distribution:archives:linux-tar:assemble
./gradlew :distribution:archives:darwin-tar:assemble
./gradlew :distribution:archives:windows-zip:assemble
To build distributions for all supported platforms, run:
./gradlew assemble
Distributions are output to distributions/archives.