Created
February 28, 2017 13:37
-
-
Save dmikurube/c73b74e55170abeb80ed3e5ffc31c3bc to your computer and use it in GitHub Desktop.
Flat Gradle example
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
apply plugin: 'java' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
testCompile 'junit:junit:4.+' | |
} | |
sourceSets { | |
main { | |
java { | |
srcDir '.' | |
exclude 'Test*.java' | |
} | |
} | |
test { | |
java { | |
srcDir '.' | |
include 'Test*.java' | |
} | |
} | |
} | |
test { | |
testLogging { | |
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' | |
} | |
} | |
task run(type:JavaExec) { | |
main = project.hasProperty('main') ? project.getProperty('main') : 'GradleFlat' | |
classpath = sourceSets.main.runtimeClasspath | |
} |
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
public class GradleFlat { | |
public static void main(String[] args) { | |
System.out.println("Hello, Gradle."); | |
} | |
} |
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
import org.junit.Assert; | |
import org.junit.Test; | |
public class TestGradleFlat { | |
@Test | |
public void test() { | |
System.out.println("Hello, Test."); | |
Assert.assertEquals(1 + 1, 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment