Getting the below error while running functional test cases after upgrading to jdk10.
Could not target platform: 'Java SE 10' using tool chain: 'JDK 8 (1.8)'.
build.gradle
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import java.text.SimpleDateFormat;
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext {
springBootVersion = '2.0.1.RELEASE'
}
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://repo.spring.io/libs-release'
url 'https://repo.spring.io/release'
url 'https://repo.spring.io/snapshot'
url 'https://repo.spring.io/milestone'
url 'https://repo.spring.io/libs-milestone'
}
maven{
url='https://plugins.gradle.org/m2/'
}
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath ("com.bmuschko:gradle-docker-plugin:3.2.1")
classpath ("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5")
classpath "gradle.plugin.au.com.dius:pact-jvm-provider-gradle_2.12:3.6.0-rc.0"
classpath ("com.moowork.gradle:gradle-node-plugin:1.2.0")
}
}
plugins {
id "java"
id "au.com.dius.pact" version "3.6.0-rc.0"
id "com.gorylenko.gradle-git-properties" version "1.4.17"
id "de.undercouch.download" version "3.4.2"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.bmuschko.docker-remote-api'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'org.sonarqube'
apply plugin: 'au.com.dius.pact'
apply plugin: 'scala'
group = 'com'
sourceCompatibility = 10
ext {
springCloudVersion = 'Finchley.RELEASE'
}
//start of integration tests changes
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('test/functional-api/java')
}
resources.srcDir file('test/functional-api/resources')
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
//end of integration tests changes
dependencies {
//web (Tomcat, Logging, Rest)
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
// Redis
//compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
//Mongo Starter
compile group: 'org.springframework.boot', name:'spring-boot-starter-data-mongodb'
// Configuration processor - To Generate MetaData Files. The files are designed to let developers offer “code completion� as users are working with application.properties
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
// Actuator - Monitoring
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
//Sleuth - Tracing
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth'
//Hystrix - Circuit Breaker
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix'
// Hystrix - Dashboard
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix-dashboard'
// Thymeleaf
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
//Voltage
// Device Detection
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-cassandra', version:'2.0.4.RELEASE'
compile group: 'com.google.guava', name: 'guava', version: '23.2-jre'
compile('com.google.code.gson:gson:2.8.0')
compile('org.json:json:20170516')
//Swagger
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.8.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.8.0'
//jkd10 fixes
compile group: 'javax.xml.bind',name: 'jaxb-api', version:'2.3.0'
compile group: 'javax.xml.soap', name: 'javax.xml.soap-api', version:'1.3.5'
compile group: 'com.sun.xml.messaging.saaj', name: 'saaj-impl', version:'1.4.0'
compile group: 'javax.activation', name: 'activation', version: '1.1.1'
compile group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version:'2.3.0.1'
//Lombok
compileOnly group: 'org.projectlombok', name: 'lombok',version:'1.18.2'
//compile group: 'io.smartcat', name: 'cassandra-diagnostics-connector21', version: '1.4.10'
//Testing
//Spring WS Test
testCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE'
testCompile('org.springframework.boot:spring-boot-starter-test'){
exclude group: "com.vaadin.external.google", module:"android-json"
}
//Pact
testCompile group: 'au.com.dius', name: 'pact-jvm-provider-gradle_2.12', version: '3.5.7'
testCompile group: 'au.com.dius', name:'pact-jvm-provider-junit_2.12',version:'3.5.13'
testCompile group: 'au.com.dius', name:'pact-jvm-consumer-junit_2.12', version:'3.5.13'
//Embedded mongo for testing
testCompile group: 'de.flapdoodle.embed', name:'de.flapdoodle.embed.mongo',version:'2.0.1'
//testCompile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.1'
compile group: 'info.cukes', name: 'cucumber-jvm', version: '1.2.5'
testCompile group: 'io.cucumber', name: 'cucumber-junit', version: '3.0.2'
compile group: 'io.cucumber', name: 'cucumber-spring', version: '3.0.2'
testCompile('org.cassandraunit:cassandra-unit-spring:3.5.0.1'){
exclude group: 'org.cassandraunit', module: 'cassandra-unit'
}
// https://mvnrepository.com/artifact/org.cassandraunit/cassandra-unit-shaded
compile group: 'org.cassandraunit', name: 'cassandra-unit-shaded', version: '3.5.0.1'
// https://mvnrepository.com/artifact/org.hectorclient/hector-core
compile group: 'org.hectorclient', name: 'hector-core', version: '2.0-0'
compile group: 'org.apache.cassandra', name: 'cassandra-all', version: '3.11.3'
integrationTestCompile group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE' //changes for integration tests
integrationTestCompile("org.springframework.boot:spring-boot-starter-test"){ //changes for integration tests
exclude group: "com.vaadin.external.google", module:"android-json"
}
//integrationTestCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5' //changes for integration tests
//integrationTestCompile group: 'info.cukes', name: 'cucumber-spring', version: '1.2.5' //changes for integration tests
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
//ignoreFailures = true
reports.junitXml.enabled = false
reports.html.enabled = true
testLogging {
exceptionFormat = 'full'
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
maxHeapSize = '2048m'
minHeapSize = '1024m'
//classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
jacocoTestReport {
group = "Reporting"
reports {
xml.enabled true
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
'**/config*',
'**/coupons/TextToClipApplication*',
'**/bean/*Request*',
'**/bean/*Response*',
])
})
}
}
test.finalizedBy jacocoTestReport
jacoco {
toolVersion = "0.8.2"
reportsDir = file("$buildDir/customJacocoReportDir")
}
//start of changes for integration tests
task apifunctionaltest(type: Test) {
systemProperty "integrationurl", System.getProperty("integrationurl")
reports.junitXml.enabled = false
reports.html.enabled = true
testLogging {
exceptionFormat = 'full'
}
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
reports.html.destination = file("${reporting.baseDir}/${name}")
}
//end of changes for integration tests
We are using cucumber to test it. Same code is working in local using gradle, but not working in server. Anyone faced the same problem ?
Thanks everyone. Issue for us is build server has been using jdk8. Now it is resolved after changing the build template to jdk10.
Related
After following: https://youtrack.jetbrains.com/issue/KT-46090
I'm still issues with:
Configure project : POM relocation to an other version number is not fully supported in Gradle : xml-apis:xml-apis:2.0.2 relocated to
xml-apis:xml-apis:1.0.b2. Please update your dependency to directly
use the correct version 'xml-apis:xml-apis:1.0.b2'. Resolution will
only pick dependencies of the relocated element. Artifacts and other
metadata will be ignored.
FAILURE: Build failed with an exception.
Where: Build file '/Users/NOTiFY/IdeaProjects/GoStopHandle/build.gradle' line: 53
What went wrong: A problem occurred evaluating root project 'GoStopHandle'.
Could not find method testCompile() for arguments [{group=org.junit.jupiter, name=junit-jupiter-api, version=5.7.1}] on
object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Gradle:
plugins {
id "war"
id "ear"
id "idea"
// id "org.jetbrains.kotlin.jvm" version "1.4.32"
// id "org.jetbrains.kotlin.plugin.jpa" version "1.4.32"
id "org.jetbrains.kotlin.jvm" version "1.5.0"
id "org.jetbrains.kotlin.plugin.jpa" version "1.5.0"
// Static Code Checkers x 4
id "checkstyle"
id "com.github.spotbugs" version "4.7.1"
id "pmd"
id "org.sonarqube" version "3.1.1"
id "org.wildfly.build.provision" version "0.0.11"
}
sourceCompatibility = 1.13
repositories {
mavenLocal()
mavenCentral()
//noinspection MultipleRepositoryUrls
maven {
name "jboss-nexus"
url "http://repository.jboss.org/nexus/content/groups/public/"
url "https://repository.jboss.org/nexus/content/groups/public-jboss"
url "https://repository.jboss.org/nexus/content/repositories"
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases"
//url "http://repository.primefaces.org"
url "https://repository.primefaces.org"
}
jcenter()
flatDir {
dirs "lib"
}
}
checkstyle {
//toolVersion "8.42"
toolVersion "8.41.1"
configFile = file("config/checkstyle/checkstyle.xml")
}
dependencies {
// JUnit 5 (Jupiter) 5.7.1 Feb, 2021
testCompile group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.7.1"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.7.1"
testCompile group: "org.junit.vintage", name: "junit-vintage-engine", version: "5.7.1"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.7.1"
// org.slf4j 25/08/2020
testCompile group: "org.slf4j", name: "slf4j-nop", version: "1.7.30"
testCompile group: "org.slf4j", name: "slf4j-simple", version: "1.7.30"
testCompile group: "org.slf4j", name: "slf4j-jdk14", version: "1.7.30"
// JBoss Weld 3.1.5.Final CDI 2.0
//compile group: "org.jboss.weld.se", name: "weld-se-core", version: "4.0.0.Final"
//compile group: "org.jboss.weld.se", name: "weld-se-core", version: "3.1.6.Final"
compile group: "org.jboss.weld.module", name: "weld-web", version: "3.1.5.Final"
compile group: "javax.ejb", name: "javax.ejb-api", version: "3.2.2"
compile group: "org.jboss.spec.javax.ejb", name: "jboss-ejb-api_3.2_spec", version: "2.0.0.Final"
compile group: "org.eclipse.persistence", name: "javax.persistence", version: "2.2.1"
compile group: "javax.inject", name: "javax.inject", version: "1"
compile group: "javax.faces", name: "javax.faces-api", version: "2.3"
compile group: "javax.enterprise", name: "cdi-api", version: "2.0.SP1"
// 09/12/20 - Fix pom -> Gradle for
compile group: "com.sun.xml.bind", name: "jaxb-impl", version: "3.0.0"
compile group: "javax.xml.bind", name: "jaxb-api", version: "2.3.1"
// 3 x Hibernate Feb, 2021
compile group: "org.hibernate", name: "hibernate-core", version: "5.4.31.Final"
compile group: "org.hibernate", name: "hibernate-entitymanager", version: "5.4.31.Final"
compile group: "org.hibernate", name: "hibernate-commons-annotations", version: "3.2.0.Final"
compile group: "org.hibernate", name: "hibernate-search-orm", version: "5.11.8.Final"
compile group: "org.hibernate.ogm", name: "hibernate-ogm-mongodb", version: "5.4.1.Final"
// 10/10/2020 x 3
compile group: "org.jboss.resteasy", name: "resteasy-jaxrs", version: "3.14.0.Final"
compile group: "org.apache.httpcomponents", name: "httpclient", version: "4.5.13"
compile group: "org.apache.httpcomponents", name: "httpcore", version: "4.4.13"
// Omnifaces + WEB-INF 2021-01-24 16:49
compile group: "org.omnifaces", name: "omnifaces", version: "3.11"
// compile group: "org.primefaces", name: "primefaces", version: "10.0.1"
implementation group: 'org.primefaces', name: 'primefaces', version: '10.0.1'
compile group: "org.primefaces.themes", name: "bootstrap", version: "1.0.10"
// mongodb - 6 February 2021
compile group: "org.mongodb", name: "mongo-java-driver", version: "3.12.8"
compile group: "com.google.code.gson", name: "gson", version: "2.8.6"
compile group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.1.1"
compile group: "org.slf4j", name: "slf4j-api", version: "1.7.30"
// Kotlin - 21-05-05
// compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "1.4.32"
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "1.5.0"
// JSoup Java HTML Parser - 01/03/2020
compile group: "org.jsoup", name: "jsoup", version: "1.13.1"
// JUnit Jupiter
//compile group: "org.junit.platform", name: "junit-platform-commons", version: "1.3.2"
//compile group: "org.opentest4j", name: "opentest4j", version: "1.1.1"
// https://mvnrepository.com/artifact/org.picketlink/picketlink-idm-parent
//compile group: "org.picketlink", name: "picketlink-idm-parent", version: "2.5.5.SP12", ext: "pom"
providedCompile "javax.ejb:javax.ejb-api:3.2.2"
//providedCompile "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.1.Final"
providedCompile group: "org.jboss.spec.javax.ejb", name: "jboss-ejb-api_3.2_spec", version: "2.0.0.Final"
providedCompile "org.eclipse.persistence:javax.persistence:2.2.0"
providedCompile "javax.inject:javax.inject:1"
providedCompile "javax.faces:javax.faces-api:2.3"
providedCompile group: "javax.enterprise", name: "cdi-api", version: "2.0.SP1"
providedCompile group: "javax.servlet", name: "javax.servlet-api", version: "4.0.1"
// Hibernate - Feb, 2021
providedCompile "org.hibernate:hibernate-core:5.4.28.Final"
providedCompile "org.hibernate:hibernate-entitymanager:5.4.28.Final"
// org.hibernate:hibernate - Mar, 2010
providedCompile "org.hibernate:hibernate-commons-annotations:3.2.0.Final"
providedCompile "org.hibernate:hibernate-search-orm:5.11.8.Final"
providedCompile "org.jboss.resteasy:resteasy-jaxrs:3.14.0.Final"
providedCompile "com.google.code.gson:gson:2.8.6"
providedCompile "org.slf4j:slf4j-api:1.7.30"
providedCompile "javax.ws.rs:javax.ws.rs-api:2.1.1"
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0"
}
checkstyleMain {
source = ["src/main/java"]
}
spotbugs {
ignoreFailures = true
toolVersion = "4.2.3"
reportsDir = file("reports/spotbugs")
effort = "max"
reportLevel = "high"
// ignoreFailures = false
// showProgress = true
// effort = "default"
// reportLevel = "default"
// visitors = [ "FindSqlInjection", "SwitchFallthrough" ]
// omitVisitors = [ "FindNonShortCircuit" ]
// reportsDir = file("$buildDir/ƒprime")
// includeFilter = file("include.xml")
// excludeFilter = file("exclude.xml")
// onlyAnalyze = [ "com.foobar.MyClass", "com.foobar.mypkg.*" ]
// maxHeapSize = "1g"
// extraArgs = [ "-nested:false" ]
// jvmArgs = [ "-Duser.language=ja" ]
}
pmd {
ignoreFailures = true
reportsDir = file("reports/pmd")
ruleSets = [
"java-basic",
"java-braces",
"java-clone",
"java-codesize",
"java-comments",
"java-controversial",
"java-coupling",
"java-design",
"java-empty",
"java-finalizers",
"java-imports",
"java-optimizations",
"java-strictexception",
"java-strings",
"java-typeresolution",
"java-unnecessary",
"java-unusedcode"
]
}
tasks.withType(Pmd) {
reports {
xml.enabled = true
html.enabled = true
}
}
tasks.withType(Checkstyle) {
reports {
html.destination rootProject.file("reports/checkstyle/checkstyle.html")
}
}
task deleteFiles(type: Delete) {
project.logger.lifecycle(">>>>> 1 deleteFiles")
delete fileTree("./build/libs") {
include "**/GoStopHandle*.?ar"
}
delete fileTree("./src/main/application") {
include "**/GoStopHandle*.war"
include "**/GoStopHandle*.jar"
include "**/GoStopHandle*.ear"
}
}
task GoStopHandleWAR(type: War) {
project.logger.lifecycle(">>>>> 2 GoStopHandleWAR")
dependsOn deleteFiles
archiveName "GoStopHandleWAR.war"
//archiveFileName "GoStopHandleWAR.war"
//webInf {
// from "WEB-INF"
//}
rootSpec.exclude("**/dto/*")
rootSpec.exclude("**/ean/*")
rootSpec.exclude("**/ejb/*")
rootSpec.exclude("**/entity/*")
rootSpec.exclude("**/filter/*")
rootSpec.exclude("**/gson/*")
//rootSpec.exclude("**/omnifaces/*")
rootSpec.exclude("**/controller/*")
// Exclude push PushEvent.class
rootSpec.exclude("**/push/PushEvent.class")
rootSpec.exclude("**/push/PushEvent.class")
rootSpec.exclude("**/webservices/*")
rootSpec.exclude("**/GoStopHandle*.jar")
rootSpec.exclude("**/GoStopHandle*.war")
}
task GoStopHandleJAR(type: Jar) {
project.logger.lifecycle(">>>>> 3 GoStopHandleJAR")
dependsOn GoStopHandleWAR
archiveName "GoStopHandleJAR.jar"
// archiveFileName "GoStopHandleJAR.jar"
from("./src/main/java") {
include "META-INF/**"
}
// Exclude
rootSpec.exclude("**/jsf/SliderViewBean.class")
rootSpec.exclude("**/push/PushBean.class")
from("./build/classes/java/main") {
include "*/**"
}
// Kotlin
from("./build/classes/kotlin/main") {
include "*/**"
}
}
task copyGoStopHandleWAR(type: Copy) {
project.logger.lifecycle(">>>>> 4 copyGoStopHandleWAR")
dependsOn GoStopHandleJAR
from file("./build/libs/GoStopHandleWAR.war")
into file("./src/main/application")
}
task copyGoStopHandleJAR(type: Copy) {
project.logger.lifecycle(">>>>> 5 copyGoStopHandleWAR")
dependsOn copyGoStopHandleWAR
from file("./build/libs/GoStopHandleJAR.jar")
into file("./src/main/application")
}
task GoStopHandleEAR(type: Ear) {
project.logger.lifecycle(">>>>> 6 GoStopHandleEAR")
apply plugin: "ear"
dependsOn copyGoStopHandleJAR
archiveName "GoStopHandle.ear"
// archiveFileName "GoStopHandle.ear"
manifest {
from("./src/main/resources/META-INF/MANIFEST.MF")
}
exclude "**/*.class"
exclude "**/asm-Java.jar"
exclude "**/jboss-deployment-structure.xml"
exclude("**/beans.xml")
dependencies {
earlib group: "com.google.code.gson", name: "gson", version: "2.8.6", ext: "jar"
earlib group: "org.apache.httpcomponents", name: "httpclient", version: "4.5.13", ext: "jar"
earlib group: "org.apache.httpcomponents", name: "httpcore", version: "4.4.13", ext: "jar"
// earlib group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "1.4.32", ext: "jar"
earlib group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "1.5.0", ext: "jar"
}
}
What is the progress or issues with Kotlin 1.5.0 & JUnit 5.7.1?
TIA.
May 19, 2021 upgrade JUnit with 5.7.2_1 still get:
What went wrong:
A problem occurred evaluating root project 'GoStopHandle'.
> Could not find method testCompile() for arguments [{group=org.junit.jupiter, name=junit-jupiter-api, version=5.7.2}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
Migrated:
compile group: -> implementation group:
I am getting an exception " java.util.NoSuchElementException at Optional.java" while running my gradle tests. I intent is to run feature files in parallel hence using the Courgette plugin.
**Jdk version used : 1.8**
Below is my Code runner class
=============================
package suites.testng;
import courgette.api.CourgetteOptions;
import courgette.api.CourgetteRunLevel;
import courgette.api.CucumberOptions;
import courgette.api.testng.TestNGCourgette;
import org.testng.annotations.Test;
#Test
#CourgetteOptions(
threads = 10,
runLevel = CourgetteRunLevel.SCENARIO,
rerunFailedScenarios = true,
showTestOutput = true,
reportTargetDir = "build/chrome",
environmentInfo = "browser=chrome; project_info=Courgette-JVM is awesome!",
plugin = {"extentreports"},
cucumberOptions = #CucumberOptions(
features = "src/test/resources/features",
glue = "steps",
tags = {"#sanity_ui"},
publish = true,
plugin = {"pretty",
"json:build/chrome/cucumber-report/cucumber.json",
"html:build/chrome/cucumber-report/cucumber.html"
}
))
public class ChromeTestSuite extends TestNGCourgette {
}
**My build.gradle file**
**=====================**
plugins {
id 'java'
id 'maven-publish'
id 'java-library'
id 'groovy'
id 'eclipse'
// id 'io.qameta.allure' version '2.8.1'
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
jcenter()
mavenCentral()
}
def cucumberVersion = '4.8.0'
def gherkinVersion = '5.1.0'
def hamcrestVersion = '1.3'
def testngVersion = '6.14.3'
def cucumber4adapterVersion = '1.0.11'
def Log4jVersion = '1.2.17'
def slf4jVersion = '1.7.5'
def restassuredVersion = '3.3.0'
def jsonsimpleVersion = '1.1.1'
def appiumjavaClientVersion = '7.3.0'
def allurePluginVersion = '2.8.1'
def allurecucumber4jvmVersion = '2.13.0'
def codeborneselenideVersion = '5.3.1'
def apacheJMeterVersion = '2.2'
def jdkIntClassesVersion = '4.5'
def azureSDKVersion = '1.36.3'
def azureClientAuthVersion = '1.0.0-beta1'
def azureStorageClientSDKVersion = '8.6.5'
def azureBlobStorageVersion = '12.0.0'
def azureCommonStorageVersion = '12.9.0-beta.2'
def fasterXMLJacksonCoreVersion = '2.2.3'
def fasterXMLJacksonAnnotationsVersion = '2.1.2'
def commonsCodecVersion = '1.6'
def commonsLoggingVersion = '1.1.3'
def dom4jVersion = '2.1.3'
def orgJSONVersion = '20140107'
def orgJSONSimpleVersion = '1.1.1'
def okioVersion = '1.13.0'
def apachePOIVersion = '3.9'
def unirestVersion = '1.4.7'
def xmlBeansVersion = '2.3.0'
dependencies {
testCompile group: 'org.testng', name: 'testng', version: '6.13.1'
compile group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '4.0.0-alpha-3'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-firefox-driver', version: '3.11.0'
testCompile 'io.github.prashant-ramcharan:courgette-jvm:5.8.0'
testCompile 'io.github.prashant-ramcharan:webdriver-binary-downloader:1.2.2'
//Cucumber Gherkin
testImplementation "io.cucumber:cucumber-gherkin:${gherkinVersion}"
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
testImplementation "io.cucumber:cucumber-jvm:${cucumberVersion}"
// testImplementation "io.cucumber:cucumber-core:${cucumberVersion}"
testImplementation "io.cucumber:cucumber-testng:${cucumberVersion}"
compile group: 'io.cucumber', name: 'cucumber-core', version: '4.8.0'
//Hamcrest
testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
//Cucumber Adapter Extent Reports
//testImplementation 'com.aventstack:extentreports:4.0.9' // Do not use this when you are using Cucumber Adapter Extent reports. Not Required when Adapter used
testImplementation "com.aventstack:extentreports-cucumber4-adapter:${cucumber4adapterVersion}"
//Log4j Logs
implementation "log4j:log4j:${Log4jVersion}" //Do not change from implementation to testImplementation otherwise PropertyConfigurator and Logger will throw errors
//Rest Assured Apis
testImplementation "io.rest-assured:rest-assured:${restassuredVersion}"
testImplementation "com.googlecode.json-simple:json-simple:${jsonsimpleVersion}"
testImplementation 'org.json:json:20180813'
//Selenium Apis
compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '3.141.59'
// implementation 'com.paulhammant:ngwebdriver:1.1.4'
implementation 'org.seleniumhq.selenium:selenium-java:3.141.59'
compile group: 'org.seleniumhq.selenium', name: 'selenium-htmlunit-driver', version: '2.52.0'
//Allure Reports
testImplementation "io.qameta.allure:allure-cucumber4-jvm:${allurecucumber4jvmVersion}"
implementation "io.qameta.allure:allure-selenide:${allurecucumber4jvmVersion}"
implementation "com.codeborne:selenide:${codeborneselenideVersion}"
//Appium
implementation "io.appium:java-client:${appiumjavaClientVersion}"
//Azure
//Azure SDK
compile group: 'com.microsoft.azure', name: 'azure', version: azureSDKVersion
//Azure Client Authentication
testCompile group: 'com.microsoft.azure', name: 'azure-client-authentication', version: azureClientAuthVersion
//Azure Storage Client SDK
compile group: 'com.microsoft.azure', name: 'azure-storage', version: azureStorageClientSDKVersion
//Azure Blob Storage
compile group: 'com.azure', name: 'azure-storage-blob', version: azureBlobStorageVersion
//Azure Common Storage
compile group: 'com.azure', name: 'azure-storage-common', version: azureCommonStorageVersion
//FasterXML (Jackson)
//Jackson Core
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: fasterXMLJacksonCoreVersion
//Jackson Annotations
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: fasterXMLJacksonAnnotationsVersion
//Commons
//Commons Codec
compile group: 'commons-codec', name: 'commons-codec', version: commonsCodecVersion
//Commons Logging
compile group: 'commons-logging', name: 'commons-logging', version: commonsLoggingVersion
//Dom4j
compile group: 'org.dom4j', name: 'dom4j', version: dom4jVersion
//JSON
compile group: 'org.json', name: 'json', version: orgJSONVersion
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: orgJSONSimpleVersion
//Okio
compile group: 'com.squareup.okio', name: 'okio', version: okioVersion
//ApachePOI
//POI
compile group: 'org.apache.poi', name: 'poi', version: apachePOIVersion
//POI OOXML
compile group: 'org.apache.poi', name: 'poi-ooxml', version: apachePOIVersion
//POI OOXML Schemas
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: apachePOIVersion
//Unirest
compile group: 'com.mashape.unirest', name: 'unirest-java', version: unirestVersion
//XMLBeans
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: xmlBeansVersion
//Netty Jar is important
compile group: 'io.netty', name: 'netty-all', version: '4.1.31.Final'
//AspectJweaver
runtime group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.6'
compile group: 'com.browserstack', name: 'browserstack-integration', version: '1.0.0'
compile group: 'com.browserstack', name: 'browserstack-local-java', version: '0.3.0'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.7'
//SqlServer
// https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.2.1.jre8'
// External Jar files
// compile fileTree(dir: 'java_lib', include: ['*.jar'])
testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
compile fileTree(dir: 'libs', include: 'testng-6.14.3.jar') //This should be last statement
}
tasks.withType(Test) {
systemProperties = System.getProperties()
systemProperties.remove("java.endorsed.dirs")
}
/* TestNG Specific Tasks
----------------------------------------------------
*/
task runTest(type: Test) {
// dependsOn compileJava, assemble, testClasses
useTestNG()
systemProperty("browser", "chrome")
include '**/lib/testng-6.14.3.jar'
include '**/suites/testng/ChromeTestSuite.class'
outputs.upToDateWhen { false }
}
task runFirefoxTestsUsingTestNG(type: Test) {
useTestNG()
systemProperty("browser", "firefox")
include '**/suites/testng/FirefoxTestSuite.class'
outputs.upToDateWhen { false }
}
**After Running I am getting the below exception**
=======================================================
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.
I am trying to create ComboPooledDataSource which is ideally present in C3P0 dependency. despite adding the gradle compile group, and doing gradle clean build, it is unable to fetch the jars related to c3p0. Below is the build.gradle file
plugins {
id 'org.springframework.boot' version '2.2.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.xyz.abc'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
sourceSets {
main {
java {
srcDir 'src'
}
}
}
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "Hoxton.RELEASE")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-c3p0', version: '5.2.10.Final'
compile group: 'com.mchange', name: 'c3p0', version: '0.9.5.2'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.amqp:spring-rabbit-test'
testImplementation 'org.springframework.security:spring-security-test'
testCompile 'junit:junit:4.12'
compile 'junit:junit:4.12'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
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
}