Last active
September 23, 2020 21:52
-
-
Save ammrat13/9bfb7adb4a3b264cf2c2c9e78dabd60d to your computer and use it in GitHub Desktop.
A Gradle build file that cooperates with VS Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
// We will use Java for this project | |
id 'application' | |
id 'java' | |
id 'org.openjfx.javafxplugin' version '0.0.9' | |
// Use Checkstyle for linting | |
id 'checkstyle' | |
// Integrate with VS Code | |
id 'eclipse' | |
} | |
buildDir = file('build/') | |
// Dependencies | |
repositories { mavenCentral() } | |
dependencies { | |
// Use the aggregate library instead of the different parts | |
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2' | |
} | |
// Change Eclipse's build directory to match Gradle's | |
// See https://github.com/gradle/gradle/issues/3825 | |
eclipse.classpath { | |
defaultOutputDir = file('build/classes/java/default') | |
file.whenMerged { | |
entries.each { source -> | |
// Handle java source files | |
if(source.path ==~ /src\/[a-z]+\/java/ | |
&& source.hasProperty('output')) { | |
source.output = | |
'build/classes/java/' + | |
(source.path =~ /(?<=src\/)[a-z]+(?=\/java)/)[0] | |
} | |
// Handle resources | |
// Handle java source files | |
if(source.path ==~ /src\/[a-z]+\/resources/ | |
&& source.hasProperty('output')) { | |
source.output = | |
'build/resources/' + | |
(source.path =~ /(?<=src\/)[a-z]+(?=\/resources)/)[0] | |
} | |
} | |
} | |
} | |
// Set main class | |
application.mainClass = 'edu.cs2340.team86.Main' | |
// Set up JavaFX | |
javafx { | |
modules = [ | |
'javafx.fxml', | |
'javafx.controls', | |
] | |
} | |
// Set up JUnit | |
test.useJUnitPlatform() | |
// Set up Checkstyle | |
checkstyle { | |
// Checkstyle cannot fail | |
ignoreFailures = false | |
maxWarnings = 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment