From the course: Gradle for Java-Based Applications and Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Compiling Java source code

Compiling Java source code

From the course: Gradle for Java-Based Applications and Libraries

Start my 1-month free trial

Compiling Java source code

- [Instructor] Part of your day-to-day workflow as a Java developer, is to create a modified Java source code to implement a feature or a bug fix. At some point of time, you will want to compile the code to ensure that it can be turned into bytecode. The Java plugin instantiates the task called compileJava. When executing the task, gradle will look for files with the extension .java in the directory src/main/java. The compiler will then compile the code with the Java version it can find on the system. Usually that's the Java distribution as indicated by the PATH environment variable. We can execute the task by running gardlew compileJava. As long as there are no issues with the source code, the compiler will produce the class files. Class files can be found in the output directory built classes. Another aspect of preparing runtime readiness for Java application, is to mix in the resource files with the class files so…

Contents