I want to compile some java files to one jar file with gradle.
The goal is to add them to a jar and check the dependcies of the tests.
Maven should integrate the junit libary.
I also want to apply some kind of filter to test only the files with *Tests.java
The build.gradle file is in the same directory as the src folder.
My file structure(folders or filenames cannot be changed):
src/eu/conflicts/Conflicts.java
src/eu/conflicts/ConflictsTests.java
src/eu/utils/BuggyUtils.java
src/eu/utils/BuggyUtilsTests.java
After running gradle -b build.gradle jar I got the error message: Could not find the main method
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
}
sourceSets {
main {
conflicts {
srcDir = 'src/eu/conflicts'
}
utils {
srcDir = 'src/eu/utils'
}
}
test {
conflicts {
srcDir = 'src/eu/conflicts'
}
utils {
srcDir = 'src/eu/utils'
}
}
}
jar {
baseName = 'xy'
version = '0.1'
manifest {
attributes("Implementation-Title": "xy",
"Implementation-Version": 0.1)
}
}