I am trying to install BEAM, an extention on MatSim through the GIT Bash and I keep running into this error. This is exactly what I get:
$ gradle classes
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file 'K:\beam\build.gradle' line: 414
* What went wrong:
A problem occurred evaluating root project 'beam'.
> For input string: "=10"
* 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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 16s
The stacktrace is too big to put in the body, but I could include a screenshot if needed.
This is my build.gradle:
import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
buildscript {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath group: 'kr.motd.gradle', name: 'sphinx-gradle-plugin', version: '1.0.3.Final'
classpath "jp.classmethod.aws:gradle-aws-plugin:0.35"
classpath "com.github.viswaramamoorthy:gradle-util-plugins:0.1.0-RELEASE"
classpath 'cz.alenkacz:gradle-scalafmt:1.7.0'
classpath 'com.bmuschko:gradle-docker-plugin:3.6.1'
}
}
plugins {
id "net.ltgt.apt" version "0.5"
id "de.undercouch.download" version "3.2.0"
id "org.scoverage" version "2.5.0"
id 'maven-publish'
}
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'kr.motd.sphinx'
apply plugin: 'application'
apply plugin: 'ManifestClasspath'
apply plugin: 'scalafmt'
apply plugin: 'com.bmuschko.docker-java-application'
group = 'beam'
version = '0.8.0'
description = """"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileScala.options.encoding = 'UTF-8'
def scalaBinaryVersion = "2.12"
def akkaBinaryVersion = "2.5.22"
def circeBinaryVersion = "0.7.1"
def slf4jVersion = "1.7.25"
def kamonVersion = "0.6.7"
def tscfgVersion = "0.9.4"
sourceSets.main.scala.srcDirs = ["src/main/scala", "src/main/java"]
sourceSets.main.java.srcDirs = []
sourceSets.test.java.srcDirs = []
sourceSets.test.scala.srcDirs = ["src/test/scala", "src/test/java"]
sourceSets {
main {
resources {
srcDir "src/main/resources"
}
}
test {
resources {
srcDir "src/test/resources"
}
}
}
if (project.hasProperty('env')) {
sourceSets {
main {
resources {
srcDirs "test/input/" + project.getProperty('env')
}
}
}
}
allprojects {
repositories {
maven { url 'https://download.osgeo.org/webdav/geotools/' }
// maven { url "https://maven.geotoolkit.org/" }
maven { url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases" }
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://download.osgeo.org/webdav/geotools" }
maven { url "https://dl.bintray.com/matsim/matsim" }
maven { url "https://maven.conveyal.com/" }
maven { url "https://repo1.maven.org/maven2" }
maven { url "https://download.java.net/maven/2/" }
maven { url "https://people.apache.org/repo/m1-ibiblio-rsync-repository/org.apache.axis2/" }
maven { url "https://dl.bintray.com/andimarek/graphql-java" }
maven { url "https://maven.geo-solutions.it" }
maven { url "https://dl.bintray.com/scalaz/releases" }
mavenLocal()
mavenCentral()
jcenter()
maven { url "http://nexus.onebusaway.org/content/groups/public/" }
maven { url "https://jitpack.io" }
}
}
dependencies {
compile(group: 'com.github.LBNL-UCB-STI', name: 'beam-utilities', version: 'v0.2.4') {
exclude group: 'com.github.LBNL-UCB-STI', module: 'r5'
exclude group: 'org.matsim', module: 'matsim'
}
////////////////////////////
// Java dependencies
////////////////////////////
compile group: 'com.google.inject', name: 'guice', version: '4.1.0'
compile group: 'com.google.inject.extensions', name: 'guice-assistedinject', version: '4.1.0'
compile group: 'com.google.inject.extensions', name: 'guice-multibindings', version: '4.1.0'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.5'
compile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.2'
// Apache 2.0
compile group: 'com.univocity', name: 'univocity-parsers', version: '2.8.1'
// LGPL
compile group: 'org.geotools', name: 'gt-main', version: '13.0'
compile group: 'org.geotools', name: 'gt-shapefile', version: '13.0'
compile group: 'org.geotools', name: 'gt-referencing', version: '15.2'
compile group: 'org.geotools', name: 'gt-epsg-wkt', version: '15.2'
compile group: 'org.jfree', name: 'jfreechart', version: '1.0.14'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.4'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-scala_2.12', version: '2.9.4'
compile group: 'javax.inject', name: 'javax.inject', version: '1'
compile group: 'jdom', name: 'jdom', version: '1.1'
compile group: 'org.jdom', name: 'jdom2', version: '2.0.5'
compile 'com.hubspot.jinjava:jinjava:2.0.5'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.18'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'net.sf.supercsv:super-csv:2.4.0'
compile 'org.reflections:reflections:0.9.10'
compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.2-b01'
compile group: 'com.github.stephenc.eaio-uuid', name: "uuid", version: "3.4.0"
compile "org.jgrapht:jgrapht-core:1.3.0"
compile ('com.github.LBNL-UCB-STI:or-tools-wrapper:7.5-0'){
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
// GPLv3
compile group: 'org.matsim.contrib', name: 'multimodal', version: '0.10.0'
compile group: 'org.matsim.contrib', name: 'bicycle', version: '0.10.0'
compile(group: 'org.matsim.contrib', name: 'decongestion', version: '0.11.0-2018w44') {
exclude group: 'org.matsim', module: 'matsim'
}
compile(group: 'com.github.wrashid.matsim', name: 'matsim', version: '0.10.1-beam-11') {
exclude group: 'log4j', module: 'log4j'
}
compile "org.slf4j:slf4j-api:${slf4jVersion}"
compile "ch.qos.logback:logback-classic:1.2.3"
compile "com.typesafe.scala-logging:scala-logging_${scalaBinaryVersion}:3.9.0"
compile "org.slf4j:log4j-over-slf4j:${slf4jVersion}"
compile(group: 'com.github.michaz', name: 'r5', version: '3ab4fa04') {
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.slf4j', module: 'slf4j-simple'
}
compile "com.sigopt:sigopt-java:4.9.0"
compile("com.uber:h3:3.4.1")
testCompile group: 'junit', name: 'junit', version: '4.8'
testCompile group: 'org.mockito', name: 'mockito-inline', version: '2.27.0'
testCompile group: "org.mockito", name: "mockito-core", version: "2.+"
/////////////////////////////////
// Scala dependencies
/////////////////////////////////
// CORE Scala //
compile "org.scala-lang:scala-library:2.12.10"
compile group: 'org.scala-lang.modules', name: "scala-xml_${scalaBinaryVersion}", version: '1.0.6'
// NEEDED FOR USING REPL //
compile "org.scala-lang:scala-compiler:2.12.10"
// TEST Scala //
testCompile group: 'org.scalatest', name: "scalatest_${scalaBinaryVersion}", version: '3.0.8'
testRuntime "org.pegdown:pegdown:1.4.2" // HTML report for scalatest
// 3rd Party Scala //
compile group: 'org.jliszka', name: 'probability-monad_2.11', version: '1.0.1'
// https://mvnrepository.com/artifact/com.beachape/enumeratum_2.12
compile group: 'com.beachape', name: "enumeratum_${scalaBinaryVersion}", version: "1.5.12"
// https://mvnrepository.com/artifact/com.beachape/enumeratum-circe_2.12
compile group: 'com.beachape', name: "enumeratum-circe_${scalaBinaryVersion}", version: "1.5.14"
compile "com.github.scopt:scopt_${scalaBinaryVersion}:3.7.0"
compile "net.codingwell:scala-guice_${scalaBinaryVersion}:4.1.0" // DI
compile('com.github.carueda:tscfg:v' + tscfgVersion) { // config
exclude group: 'org.scala-lang.modules', module: 'scala-xml_2.11'
}
// https://mvnrepository.com/artifact/io.circe/circe-core_2.12
compile group: 'io.circe', name: "circe-core_${scalaBinaryVersion}", version: circeBinaryVersion
// https://mvnrepository.com/artifact/io.circe/circe-generic_2.12
compile group: 'io.circe', name: "circe-generic_${scalaBinaryVersion}", version: circeBinaryVersion
// https://mvnrepository.com/artifact/io.circe/circe-parser_2.12
compile group: 'io.circe', name: "circe-parser_${scalaBinaryVersion}", version: circeBinaryVersion
compile group: 'com.typesafe.play', name: "play-json_${scalaBinaryVersion}", version: '2.6.3'
compile (group: 'com.github.romix.akka', name: "akka-kryo-serialization_${scalaBinaryVersion}", version: '0.5.2') {
exclude group: 'com.esotericsoftware', module: 'kryo'
}
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.2'
compile "com.github.vagmcs:optimus_${scalaBinaryVersion}:3.1.0"
compile "com.github.vagmcs:optimus-solver-oj_${scalaBinaryVersion}:3.1.0"
////////////////////////////////////
///Performance Monitoring (Kamon)///
////////////////////////////////////
compile("io.kamon:kamon-core_${scalaBinaryVersion}:${kamonVersion}")
compile("io.kamon:kamon-scala_${scalaBinaryVersion}:${kamonVersion}")
compile("io.kamon:kamon-akka-2.4_${scalaBinaryVersion}:${kamonVersion}")
compile("io.kamon:kamon-statsd_${scalaBinaryVersion}:${kamonVersion}")
compile "io.kamon:kamon-influxdb_${scalaBinaryVersion}:0.6.9"
compile("io.kamon:kamon-log-reporter_${scalaBinaryVersion}:${kamonVersion}")
/////////////
// Akka Dependencies
////////////
// CORE Akka //
compile group: 'com.typesafe.akka', name: "akka-actor_${scalaBinaryVersion}", version: akkaBinaryVersion
compile group: 'com.typesafe.akka', name: "akka-slf4j_${scalaBinaryVersion}", version: akkaBinaryVersion
//compile group: 'com.typesafe.akka', name: "akka-persistence_${scalaBinaryVersion}", version: akkaBinaryVersion
//compile group: 'com.typesafe.akka', name: "akka-remote_${scalaBinaryVersion}", version: akkaBinaryVersion
compile group: 'com.typesafe.akka', name: "akka-cluster_${scalaBinaryVersion}", version: akkaBinaryVersion
compile group: 'com.typesafe.akka', name: "akka-contrib_${scalaBinaryVersion}", version: akkaBinaryVersion
//compile group: 'org.iq80.leveldb', name: 'leveldb', version: '0.9'
compile group: 'com.typesafe.akka', name: "akka-http_${scalaBinaryVersion}", version: "10.1.8"
compile group: 'de.heikoseeberger', name: "akka-http-circe_${scalaBinaryVersion}", version: "1.25.2"
// TEST Akka //
testCompile group: 'com.typesafe.akka', name: "akka-testkit_${scalaBinaryVersion}", version: akkaBinaryVersion
// 3rd Party Akka //
//compile group: 'org.iq80.leveldb', name: 'leveldb', version: '0.7'
//compile group: 'org.fusesource.leveldbjni', name: 'leveldbjni-all', version: '1.8'
//compile group: 'com.google.protobuf', name: 'protobuf-java', version: '2.5.0'
scoverage "org.scoverage:scalac-scoverage-plugin_${scalaBinaryVersion}:1.3.1", "org.scoverage:scalac-scoverage-runtime_${scalaBinaryVersion}:1.3.1"
compile 'org.apache.commons:commons-compress:1.18'
compile group: 'de.lmu.ifi.dbs.elki', name: 'elki', version:'0.7.5'
compile group: 'com.zaxxer', name: 'nuprocess', version: '1.2.4'
def parquet = "1.10.0"
compile group: 'org.apache.parquet', name: 'parquet-hadoop', version: parquet
compile group: 'org.apache.parquet', name: 'parquet-avro', version: parquet
compile (group: 'org.apache.hadoop', name: 'hadoop-client', version: '2.7.3') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
// Exclude `ASM` because it is binary incompatible with the one which is gotten from `com.conveyal:kryo-tools`: `org.ow2.asm:asm:5.0.4`
exclude group: 'asm', module: 'asm'
}
}
// Autoformatting using scalafmt
scalafmt {
// configFilePath = ".scalafmt.conf" // .scalafmt.conf in the project root is default value, provide only if other location is needed
}
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails dependencyResolveDetails ->
final requestedDependency = dependencyResolveDetails.requested
if (requestedDependency.name != 'beam-utilities') {
force 'javax.media:jai_core:1.1.3'
}
}
}
exclude group: 'javax.media', module: 'jai_codec'
exclude group: 'javax.media', module: 'jai_imageio'
}
//compileScala.dependsOn(scalafmtAll)
// Task to run scala tests, as Scala tests not picked up by Gradle by default.
task spec(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-h', 'build/scalatest-report', '-oD', '-l', 'beam.tags.ExcludeRegular']
classpath = sourceSets.test.runtimeClasspath
}
build.dependsOn spec
/* //////////////////////////////////////////////////
* Task to run tagged tests.
* Note: use space separated list of tags
* ./gradlew taggedTest -Ptags="beam.tags.Performance beam.tags.Integration"
* /////////////////////////////////////////////////// */
task taggedTest(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o', '-n'] << (project.findProperty('tags') ?: 'org.scalatest.Ignore')
classpath = sourceSets.test.runtimeClasspath
}
task specificTest(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o', '-s'] << (project.findProperty('suite') ?: 'org.scalatest.Ignore')
classpath = sourceSets.test.runtimeClasspath
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Task to run tests periodically on continue integration server.
// ./gradlew periodicTest -Pconfig=test/input/sf-light/sf-light-1k.conf -Piterations=1
////////////////////////////////////////////////////////////////////////////////////////////////////////////
task periodicTest(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o', '-n', 'beam.tags.Periodic'] <<
(project.hasProperty('config') ? '-Dconfig=' + project.findProperty('config') :
(project.hasProperty('iterations') ? '-Diterations=' + project.findProperty('iterations') : '')) <<
(project.hasProperty('config') && project.hasProperty('iterations') ?
'-Diterations=' + project.findProperty('iterations') : '')
jvmArgs = ['-javaagent:build/aspectjweaver-1.8.10.jar']
classpath = sourceSets.test.runtimeClasspath
doFirst() {
if (!project.file('build/aspectjweaver-1.8.10.jar').exists()) {
download {
src 'https://repo1.maven.org/maven2/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar'
dest buildDir
}
}
}
}
//////////////////////////////////////////////////////////////////////
// Generate config classes reflecting the application.conf file
//////////////////////////////////////////////////////////////////////
task generateConfig {
doLast {
def tscfgJarFile = project.file('build/tscfg-' + tscfgVersion + '.jar')
if (!tscfgJarFile.exists() || !tscfgJarFile.isFile()) {
download {
src 'https://github.com/carueda/tscfg/releases/download/v' + tscfgVersion + '/tscfg-' + tscfgVersion + '.jar'
dest buildDir
}
}
javaexec {
main = "-jar"
args = [
"build/tscfg-${tscfgVersion}.jar",
"--spec", "src/main/resources/beam-template.conf",
"--scala",
"--pn", "beam.sim.config",
"--cn", "BeamConfig",
"--dd", "src/main/scala/beam/sim/config/"
]
}
}
}
task repl(type: JavaExec) {
main = "scala.tools.nsc.MainGenericRunner"
classpath = sourceSets.main.runtimeClasspath
standardInput System.in
args '-usejavacp'
}
task deleteSf {
doLast {
if (project.file('production/application-sfbay/r5/network.dat').exists()) {
delete 'production/application-sfbay/r5/network.dat'
}
if (project.file('production/application-sfbay/r5/osm.mapdb').exists()) {
delete 'production/application-sfbay/r5/osm.mapdb'
}
if (project.file('production/application-sfbay/r5/osm.mapdb.p').exists()) {
delete 'production/application-sfbay/r5/osm.mapdb.p'
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Run Via application plugin
// Note: colon preceding "run" is necessary to only run the main project and not launch the GUI as well.
// ./gradlew :run -PappArgs="['--config', 'production/application-sfbay/beam.conf']"
////////////////////////////////////////////////////////////////////////////////////////////////////////////
mainClassName = "beam.sim.RunBeam"
def myAvailableRam = (System.getenv("MAXRAM") ?: (project.findProperty('maxRAM') ?: "140")).toString().replace("g", "").toInteger()
def getCurrentTimestamp = {
DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss")
.withLocale(Locale.US)
.withZone(ZoneOffset.UTC)
.format(Instant.now())
}
def logGC = ["-XX:+PrintGCDetails", "-XX:+PrintGCDateStamps", "-Xloggc:gc_${getCurrentTimestamp()}.log"]
// Use following for remote debug mode
def remoteDebug = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8005"]
def jfr = ["-XX:+UnlockCommercialFeatures", "-XX:+FlightRecorder",
"-XX:FlightRecorderOptions=defaultrecording=true,disk=true,maxage=10h,dumponexit=true,loglevel=info"]
// On the running machine there should be file /usr/lib/jvm/java-8-oracle/jre/lib/jfr/profile_heap_exception.jfc with content from
// https://pastebin.com/N3uuUfPz - it's Java Mission Control with metrics about heap allocation and details about exceptions
def jfrWithMem = ["-XX:+UnlockCommercialFeatures", "-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints",
"-XX:StartFlightRecording=delay=2s,duration=60m,name=mem_ex,filename=recording.jfr,settings=profile_heap_exception",
"-XX:+FlightRecorder", "-XX:FlightRecorderOptions=disk=true,maxage=10h,dumponexit=true,loglevel=info"]
def jmx = ["-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.port=9005", "-Dcom.sun.management.jmxremote.host=127.0.0.1",
"-Dcom.sun.management.jmxremote.local.only=true", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false",
"-Djava.net.preferIPv4Stack=true", "-Djava.rmi.server.hostname=127.0.0.1"]
// UseParallelGC
applicationDefaultJvmArgs = ["-Xmx${myAvailableRam}g", "-Xms${myAvailableRam/2}g",
"-XX:+UseParallelGC", "-XX:+UseParallelOldGC", "-XX:MetaspaceSize=150M", "-Djava.awt.headless=true",
"-Dlogback.configurationFile=logback_prod.xml", "-Xss2048k"] + logGC + jmx
println(applicationDefaultJvmArgs)
run {
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
doFirst() {
if (!project.file('build/aspectjweaver-1.8.10.jar').exists()) {
download {
src 'https://repo1.maven.org/maven2/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar'
dest buildDir
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Run ExperimentGenerator from Command line
// gradle :execute -PmainClass=beam.experiment.ExperimentGenerator -PappArgs="['--experiments', 'test/input/beamville/example-experiment/experiment.yml']"
// Run R5 GUI server
// gradle --stacktrace :execute -PmainClass=com.conveyal.r5.R5Main -PappArgs="['point','--graphs','production/application-sfbay/r5/']"
////////////////////////////////////////////////////////////////////////////////////////////////////////////
task execute(type: JavaExec) {
jvmArgs = applicationDefaultJvmArgs
if (project.hasProperty("mainClass")) {
main = mainClass
} else {
main = mainClassName
}
classpath = sourceSets.main.runtimeClasspath
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
doFirst() {
if (!project.file('build/aspectjweaver-1.8.10.jar').exists()) {
download {
src 'https://repo1.maven.org/maven2/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar'
dest buildDir
}
}
}
}
task matsimConversion(type: JavaExec) {
main = 'beam.utils.matsim_conversion.MatsimConversionTool'
classpath = sourceSets.main.runtimeClasspath
environment "PWD", "na"
if (project.hasProperty("confPath")) {
args Eval.me(confPath)
// if this triggers an error, try
// args "${confPath}"
}
}
task generateDocumentation(type: JavaExec) {
group 'Documentation'
description 'Format the data using Sphinx RST formats'
main = 'beam.docs.GenerateDocumentationTask'
classpath = sourceSets.main.runtimeClasspath
}
tasks.withType(ScalaCompile) {
// Enable Scala warnings output
scalaCompileOptions.additionalParameters = ["-unchecked", "-deprecation", "-feature", "-Xfatal-warnings"]
}
task fmt(dependsOn: scalafmtAll)
task checkScalaFmt() {
doLast {
try {
def workingDir = new File("${project.projectDir}")
def result = 'git diff --exit-code'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() != 0) throw new Exception("""
Please run ./gradlew scalaFmtAll and commit/push the subsequent results to fix this error.
This happened because a git diff yielded a non-zero exit code.
This task was built to be run on the CI server AFTER scalaFmtAll
It should only error if the results of scalaFmtAll resulted in code modifications.
And that would only happen if the committed code is not formatted as expected.""")
} catch (e) {
throw new Exception("An unexpected error was encountered while checking that scalaFmtAll was committed.", e)
}
}
}
docker{
registryCredentials {
url = 'https://index.docker.io/v1/'
username = System.getenv("DOCKER_USER")
password = System.getenv("DOCKER_PASSWORD")
}
javaApplication {
baseImage = 'continuumio/miniconda3'
maintainer = 'LBNL Beam Team'
tag = "beammodel/beam:$version"
}
}
dockerDistTar {
instruction 'RUN apt-get update && apt-get -y install openjdk-8-jdk && rm -rf /var/lib/apt/lists/*'
addFile 'test/', 'test/'
}
dockerCopyDistResources {
from('test/') {
into('test/')
}
}
Specifically line 414 is:
def myAvailableRam = (System.getenv("MAXRAM") ?: (project.findProperty('maxRAM') ?: "140")).toString().replace("g", "").toInteger()
Any help with this would be awesome, none of this is my own code, this is all cloned from a git repository that should be working.
Gradle project
Tying to implement grpc - unary API using java-gradle project
Build.gradle
group = "com.kaushik.grpc"
version = "1.0-SNAPSHOT"
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'idea'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
}
}
repositories {
mavenCentral()
}
description = "gRPC Java Examples"
dependencies {
compile 'io.grpc:grpc-all:0.13.1'
}
protobuf {
protoc {
// The version of protoc must match protobuf-java. If you don't depend on
// protobuf-java directly, you will be transitively depending on the
// protobuf-java version that grpc depends on.
artifact = "com.google.protobuf:protoc:3.0.0-beta-2"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:0.13.1'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
greet.proto
syntax = "proto3";
package greet;
option java_package = "com.proto.greet";
option java_multiple_files = true;
message Greeting {
string first_name = 1;
string last_name = 2;
}
message GreetRequest {
Greeting greeting = 1;
}
message GreetResponse {
string result = 1;
}
service GreetService {
//unary
rpc Greet(GreetRequest) returns (GreetResponse) {};
}
while trying to extend GreetServiceGrpc
import com.proto.greet.GreetServiceGrpc;
public class GreetServiceImpl extends GreetServiceGrpc.GreetServiceImplBase{
}
Cannot resolve symbol GreetServiceImplBase.
There is no class with GreetServiceImplBase even in build path.
GreetServiceImplBase is generated based on the configuration(depedencies, generated source directories) in the gradle file. Sample entry in the gradle file :
dependencies {
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.6.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'io.grpc', name: 'grpc-stub', version: '1.16.1'
compile group: 'io.grpc', name: 'grpc-protobuf', version: '1.16.1'
compile group: 'io.grpc', name: 'grpc-netty', version: '1.16.1'
compile "io.grpc:grpc-all:1.16.1"
compile group: 'com.github.os72', name: 'protoc-jar', version: '3.6.0'
compile group: 'org.projectlombok', name:'lombok', version: '1.18.4'
compile 'com.google.protobuf:protobuf-java-util:3.6.1'
}
sourceSets {
main {
java {
srcDirs = ["src/main/java/", "src/generated/main/grpc/", "src/generated/main/java/"]
}
}
test {
java {
srcDirs = ["src/test/"]
}
}
}
idea {
module {
sourceDirs += file("${projectDir}/src/generated/main/java");
sourceDirs += file("${projectDir}/src/generated/main/grpc");
}
}
clean {
delete "$projectDir/src/generated"
}
Now execute the gradle task "generateProto"
I am working on selenium Gradle project in which I accidentally changed some configuration that causes changes in build structure. before change my project structure was
project-dir
.gradle
.idea
build
gradle
out
src
now its
project-dir
.gradle
.idea
classes
gradle
out
src
when I run command "gradlew build" it should run all the feature files but it is not working after change. can you help me what went wrong. I am new to all this.
I am using
gradle 4.12
selenium 2.53.0
cucumber-junit 1.2.5
cucumber-java 1.2.5
cucumber-core 1.2.5
Gradle.build file:
-
import java.text.DateFormat
import java.text.SimpleDateFormat
version '1.0-SNAPSHOT'
task gitBuildId {
description = "Determine the build id from git"
def buildIdOut = new ByteArrayOutputStream()
def errorsOut = new ByteArrayOutputStream()
def extraInfo = ""
try {
exec {
// TODO: use a java git library?
standardOutput = buildIdOut
errorOutput = errorsOut
commandLine 'git', 'log', '-1', '--pretty=format:%ct|%h', 'HEAD'
}
} catch (Exception e) {
buildIdOut.write('0'.getBytes())
if (errorsOut.toString().contains("Not a git repository")) {
extraInfo = "(Not a git repository and/or no commits found)\n" +
"Type: git init; git add *; git commit *;"
}
}
//OR? def buildIdOut = (long) ((new Date()).getTime() / 1000)
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss")
df.setTimeZone(TimeZone.getTimeZone("GMT"))
//split into hash and timestamp
String[] parts = buildIdOut.toString().split("\\|")
def inTimeStamp = Long.parseLong(parts[0])
def date = new Date((inTimeStamp as long) * 1000)
def dateString = df.format(date)
def buildId = "${dateString}.${parts[1]}"
println "buildId = ${buildId} ${extraInfo}"
ext.output = {
return buildId
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
//def buildId = rootProject.tasks.gitBuildId.output()
def rpmVersion = '0.0.0'
//apply plugin: 'java'
//apply plugin: 'gradle-one-jar'
apply plugin: 'application'
//apply plugin: 'idea'
sourceCompatibility = 1.8
// UTF-8 should be standard by now. So use it!
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
mainClassName = 'cucumber.api.cli.Main'
// Add Gradle OneJar Plugin, see https://github.com/rholder/gradle-one-jar
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.0'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-jvm-deps', version: '1.0.3'
testCompile group: 'info.cukes', name: 'gherkin', version: '2.7.3'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.8'
testCompile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
testCompile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.6'
testCompile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.0.2'
testCompile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6'
testCompile group: 'org.json', name: 'json', version: '20140107'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
compile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-jvm-deps', version: '1.0.3'
}
// Configure the oneJar task
task oneJar() {
doLast {
mainClass = mainClassName
}
}
//def buildId = rootProject.tasks.gitBuildId.output()
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'application'
mainClassName = 'cucumber.api.cli.Main'
// IDE support
apply from: rootProject.file('gradle/ide.gradle')
//cucumber support
//apply from: rootProject.file('gradle/cucumber.gradle')
if (version == 'unspecified') {
version = '0.0.0'
def envVersion = System.env['VERSION']
if (envVersion) {
version = envVersion
}
}
distZip.doFirst {
copy {
from('bin') {
include '**/*'
}
into file("src/dist/bin")
fileMode = 0755
}
}
}
task deleteTestResults() {
delete "build/test-results/test/"
delete "cucumber-html-reports"
}
/*task cucumberTest() {
def arglist = ["--monochrome", "--plugin", "pretty", "--glue", "com.automation.server",
"src/test/resources/features/"]
return javaexec {
main = "cucumber.api.cli.Main"
classpath = sourceSets.main.runtimeClasspath
args = arglist
}
}*/
test {
//we want display the following test events
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
//showStandardStreams = true
}
}
task testBoth {
println 'This is executed last during the execution phase.'
}
task wrapper(type: Wrapper) {
gradleVersion = '4.0'
}
artifacts {
oneJar
}
I have a project that requires native libraries to run.
I'm using the Gradle-Support Netbeans plugin.
apply plugin: "java"
apply plugin: "application"
apply plugin: "eclipse"
sourceCompatibility = 1.7
mainClassName = "com.myPackage.MainClass"
if (!project.hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
repositories {
mavenCentral()
maven {
url "http://teleal.org/m2"
}
}
dependencies {
compile group: "com.esotericsoftware.kryo", name: "kryo", version: "2.23.0"
compile group: "net.java.jinput", name: "jinput", version: "2.0.5"
compile group: "org.jcraft", name: "jorbis", version: "0.0.17"
compile group: "org.jdom", name: "jdom2", version: "2.0.5"
compile group: "org.lwjgl.lwjgl", name: "lwjgl", version: "2.9.0"
compile group: "org.lwjgl.lwjgl", name: "lwjgl_util", version: "2.9.0"
compile group: "org.teleal.cling", name: "cling-core", version: "1.0.5"
compile group: "org.teleal.cling", name: "cling-support", version: "1.0.5"
compile group: "xpp3", name: "xpp3", version: "1.1.4c"
compile files("./lib/jars/kryonet-2.21.jar")
compile files("./lib/jars/slick.jar")
compile files("./lib/jars/slick-util.jar")
compile files("./lib/jars/TWL.jar")
}
jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes "Main-Class": project.mainClassName
}
}
run {
configureRun(it)
}
task(debug, dependsOn: 'classes', type: JavaExec) {
configureRun(it)
classpath = sourceSets.main.runtimeClasspath
}
void configureRun (def task){
main = mainClass
task.systemProperty "java.library.path", "./lib/native/"
}
The application will launch fine in run mode but debug mode yields the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':debug'.
> No main class specified
I assume, you are using the application plugin and that is why this configuration for the run task is enough. That is, most likely you should have something like this:
if (!project.hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
run {
configureRun(it)
}
task(debug, dependsOn: 'classes', type: JavaExec) {
configureRun(it)
classpath = sourceSets.main.runtimeClasspath
}
void configureRun(def task) {
main = mainClass
task.systemProperty "java.library.path", "./lib/native/"
}
task(debug, dependsOn: 'classes', type: JavaExec) {
Looks like you're adding an action instead of configuring the the task, all your configuration on the task happens too late, that is at the execution time.
Either that or make sure your main (you must have one somewhere, right? I'm new to this) looks like:
public static void main (String[] args)throws Exception
My research led me to here: (this site may help you with gradle) http://forums.gradle.org/gradle/topics/problem_with_javaexec