JUnit test cannot properly load xercesImpl jar that is required by fop 0.20.5 - gradle

Gradle dependencies:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
compileOnly 'org.projectlombok:lombok:1.18.4'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
//compile group:'net.sf.barcode4j', name: 'barcode4j-fop-ext', version: '2.1'
// logging
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.12.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.1'
// FOP 1.1 & SAXON
compile group:'org.apache.xmlgraphics', name: 'fop', version: '1.1'
// compile group:'org.apache.xmlgraphics', name: 'fop-patched', version: '1.1'
compile "org.apache.servicemix.bundles:org.apache.servicemix.bundles.saxon:9.5.1-5_1"
// FOP ยป 0.20.5
compile group:'fop', name: 'fop', version: '0.20.5'
compile group: 'org.apache.avalon.framework', name: 'avalon-framework-impl', version: '4.3.1'
compile group:'batik', name: 'batik-1.5-fop', version: '0.20-5'
compile group: 'xalan', name: 'xalan', version: '2.4.1'
compile group: 'xerces', name: 'xercesImpl', version: '2.2.1'
compile group: 'xml-apis', name: 'xml-apis', version: '1.0.b2'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.2.1.RELEASE'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
}
FileNotFoundException:
file:/C:/Users/user/.gradle/caches/modules-2/files-2.1/fop/fop/0.20.5/ffa9d8eb84897746aa196d3f3336d034ddb26f59/xercesImpl-2.2.1.jar
The fop jar indeed does not have xercesImpl-2.2.1.jar. The code uses class org.apache.fop.apps.Driver. The jar lib actual path is
\.gradle\caches\modules-2\files-2.1\xerces\xercesImpl\2.2.1\a6d76534ef05c5f1a6ed8ed7556010e0cb41244e

Splitting the project into different modules solved the problem.

Related

Receive an error unable to find method testImplementation() when trying to deploy my gradle app to heroku

I have tried the solutions recommended by many in SO but none has worked so far. I am new to heroku, just created an account and followed their instructions on how to deploy my app on it. So far every attempt has failed, and I don't know how to resolve it.
plugins {
id 'application'
id 'jacoco'
}
repositories {
jcenter()
}
dependencies {
def junitVer = '5.6.2'
implementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'
implementation group: 'com.h2database', name: 'h2', version: '1.4.200'
implementation group: 'net.sf.oval', name: 'oval', version: '2.1.6'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVer
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVer
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.+'
testImplementation group: 'org.assertj', name: 'assertj-swing-junit', version: '3.+'
def joobyVer = '1.6.8'
implementation group: 'org.jooby', name: 'jooby-netty', version: joobyVer
implementation group: 'org.jooby', name: 'jooby-gson', version: joobyVer
implementation group: 'org.apache.commons', name: 'commons-email', version: '1.5'
implementation group:'org.bouncycastle', name:'bcprov-jdk15on', version:'1.66'
}
Error Received
Thank you, if anyone has any idea how to solve this issue.

Swagger UI not loading in spring boot through springdoc openAPI dependency

By adding the dependency springdoc-openapi-ui, it is supposed to generate a swaggerui at http://localhost:8080/swagger-ui.html. However it didnt. How to understand why the springboot app is not loading the swagger UI ?
My dependency list
dependencies {
compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-rest', version:'7.15.0'
compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-webapp', version:'7.15.0'
compile group: 'org.camunda.bpm', name: 'camunda-engine-plugin-spin', version:'7.15.0'
compile group: 'org.camunda.spin', name: 'camunda-spin-dataformat-all', version:'1.10.1'
compile group: 'org.camunda.bpm.springboot', name: 'camunda-bpm-spring-boot-starter-test', version:'7.15.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version:'2.4.3'
compile group: 'com.h2database', name: 'h2', version:'1.4.200'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version:'2.4.3'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.5.2'
}

Set VM option for TestNG in Gradle

I need to pass VM option argument to gradle. So far I configured it in IntelliJ as on the screen below and it works fine, but when I run the tests through gradle commands it doesn't work.
I need to pass -javaagent:"C:\aspectjweaver-1.9.5.jar" somewhere in the code. I tried jvmArgs and gradle.properties but no success.
Is there any way to make it working?
My build.gradle file:
plugins {
id 'java'
id 'maven'
}
sourceCompatibility = 1.12
targetCompatibility = 1.12
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://dl.bintray.com/cbeust/maven/" }
maven { url "https://plugins.gradle.org/m2/" }
}
tasks.withType(Test) {
outputs.upToDateWhen { false }
environment 'driver_type', project.hasProperty('driver_type') ? project.driver_type : 'chrome'
environment 'env', project.hasProperty('env') ? project.env : 'dev'
useTestNG() {
if (project.getProperties().get("env") == "prod") {
suites 'src/test/resources/testSuites/testng_prod.xml'
} else if (project.getProperties().get("env") == "stg") {
suites 'src/test/resources/testSuites/testng_stg.xml'
} else if (project.getProperties().get("env") == "dev") {
suites 'src/test/resources/testSuites/testng_dev.xml'
}
}
testLogging {
events "PASSED", "SKIPPED", "FAILED"
showExceptions true
exceptionFormat = 'full'
}
}
dependencies {
compile group: 'org.aspectj', name: 'aspectjweaver', version: "$aspectjVersion"
compile group: 'org.aspectj', name: 'aspectjrt', version: "$aspectjVersion"
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.15'
compile group: 'org.seleniumhq.selenium', name: 'selenium-api', version: "$seleniumVersion"
compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version: "$seleniumVersion"
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: "$seleniumVersion"
compile group: 'org.seleniumhq.selenium', name: 'selenium-support', version: "$seleniumVersion"
compile group: 'org.testng', name: 'testng', version: '6.14.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.0'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.4'
compile group: 'org.apache.poi', name: 'poi', version: '3.14'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.14'
compile group: 'com.opencsv', name: 'opencsv', version: '3.8'
compile group: 'org.assertj', name: 'assertj-core', version: '3.13.2'
compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
compile group: 'log4j', name: 'log4j', version: '1.2.16'
compile group: 'com.aventstack', name: 'extentreports', version: '4.0.9'
compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
}
The doFirst did the job. Also I added ${aspectPath} to gradle.properties
tasks.withType(Test) {
useTestNG() {
...
}
doFirst {
jvmArgs "-javaagent:${aspectPath}"
}
}

neo4j-2.2.5.pom cannot be read of is not a valid zip file error

After I updated spring-data-neo4j to latest version: 4.0.0.RELEASE, I am getting the java build path error as follows:
'C:/Users/UserName/.gradle/caches/modules-2/files-2.1/org.neo4j/neo4j/2.2.5/c7c8174f5a175a96686a461033a9f7e01d24df1d/neo4j-2.2.5.pom'
in project 'movements-jhipster-neo4j-4-issue' cannot be read or is not
a valid ZIP file movements-jhipster-neo4j-4-issue Build path Build
Path Problem
build.gradle:
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.spring.io/libs-release"}
jcenter()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE')
classpath('com.moowork.gradle:gradle-node-plugin:0.10')
classpath('com.moowork.gradle:gradle-grunt-plugin:0.10')
}
}
apply plugin: 'java'
sourceCompatibility=1.7
targetCompatibility=1.7
apply plugin: 'maven'
apply plugin: 'spring-boot'
apply plugin: 'war'
bootRepackage {
mainClass = 'com.movements.jhipster.Application'
}
springBoot {
mainClass = 'com.movements.jhipster.Application'
}
bootRun {
addResources = false
}
apply from: 'yeoman.gradle'
apply from: 'gatling.gradle'
if (project.hasProperty('prod')) {
apply from: 'profile_prod.gradle'
} else if (project.hasProperty('fast')) {
apply from: 'profile_fast.gradle'
} else {
apply from: 'profile_dev.gradle'
}
group = 'com.movements.jhipster'
version = '0.1-SNAPSHOT'
description = ''
configurations {
providedRuntime
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/libs-release"
maven { url 'https://repository.jboss.org/nexus/content/repositories/releases' }
maven { url 'https://oss.sonatype.org/content/repositories/releases' }
}
}
dependencies {
compile group: 'io.dropwizard.metrics', name: 'metrics-core'
compile group: 'io.dropwizard.metrics', name: 'metrics-graphite'
compile group: 'io.dropwizard.metrics', name: 'metrics-healthchecks'
compile group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-servlet', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-json', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-servlets'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-json-org', version: jackson_version
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hppc', version: jackson_version
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate4', version: jackson_version
compile (group: 'com.ryantenney.metrics', name: 'metrics-spring', version: metrics_spring_version) {
exclude(module: 'metrics-core')
exclude(module: 'metrics-healthchecks')
}
compile(group: 'com.zaxxer', name: 'HikariCP-java6') {
exclude(module: 'tools')
}
compile group: 'commons-lang', name: 'commons-lang', version: commons_lang_version
compile group: 'commons-io', name: 'commons-io', version: commons_io_version
compile group: 'javax.inject', name: 'javax.inject', version: javax_inject_version
compile group: 'javax.transaction', name: 'javax.transaction-api'
compile group: 'joda-time', name: 'joda-time'
compile group: 'org.apache.geronimo.javamail', name: 'geronimo-javamail_1.4_mail', version: geronimo_javamail_1_4_mail_version
compile group: 'org.hibernate', name: 'hibernate-validator'
compile group: 'org.springframework.boot', name: 'spring-boot-actuator'
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
compile group: 'org.springframework.boot', name: 'spring-boot-loader-tools'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
//Neo4j
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile 'org.springframework.data:spring-data-neo4j:4.0.0.RELEASE' //3.3.2.RELEASE'
//Mongo
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb'
compile 'org.springframework.data:spring-data-mongodb:1.8.0.RELEASE'
//Redis
compile group: 'org.springframework.boot', name: 'spring-boot-starter-redis'
compile 'org.springframework.data:spring-data-redis:1.6.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security'
compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web') {
exclude module: 'spring-boot-starter-tomcat'
}
compile group: 'org.springframework.boot', name: 'spring-boot-starter-websocket'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
//compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector'
compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector'
compile group: 'org.springframework.cloud', name: 'spring-cloud-localconfig-connector'
compile(group: 'org.springframework', name: 'spring-context-support') {
exclude(module: 'quartz')
}
compile group: 'org.springframework.security', name: 'spring-security-config', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-data', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-web', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-messaging', version: spring_security_version
compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: spring_security_oauth2_version
compile group: 'org.mongeez', name: 'mongeez', version: mongeez_version
compile(group: 'io.springfox', name: 'springfox-swagger-ui', version: springfox_version)
compile(group: 'io.springfox', name: 'springfox-swagger2', version: springfox_version){
exclude module: 'org.mapstruct.mapstruct'
}
//AWS
compile 'com.amazonaws:aws-java-sdk-core:1.10.1'
compile 'com.amazonaws:aws-java-sdk-sns:1.10.1'
compile 'com.amazonaws:aws-java-sdk-s3:1.10.1'
compile 'com.amazonaws:aws-java-sdk-cloudfront:1.10.1'
compile 'com.amazonaws:aws-java-sdk-elastictranscoder:1.10.1'
compile 'com.amazonaws:aws-java-sdk-sts:1.10.1'
compile 'org.springframework.cloud:spring-cloud-aws-messaging:1.0.1.RELEASE'
testCompile group: 'com.jayway.awaitility', name: 'awaitility', version: awaility_version
testCompile group: 'com.jayway.jsonpath', name: 'json-path'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
testCompile group: 'org.assertj', name: 'assertj-core', version: assertj_core_version
testCompile group: 'junit', name: 'junit'
testCompile group: 'org.mockito', name: 'mockito-core'
testCompile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: embedmongo_spring_version
testCompile group: 'org.hamcrest', name: 'hamcrest-library'
testCompile group: 'io.gatling.highcharts', name: 'gatling-charts-highcharts', version: gatling_version
testCompile group: 'com.h2database', name: 'h2'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
task stage(dependsOn: 'bootRepackage') {
}

How to build on travis-ci with gradle and cobertura

Today I've tried to connect my travis-ci with coveralls using cobertura reports. Unfortunatelly after adding cobertura to my project travis cannot succeed in building my project.
Here's exemplary build: https://travis-ci.org/bandrzejczak/activiti-console-rest/jobs/38356310
And here's my build.gradle file:
plugins {
id 'java'
id 'war'
id 'idea'
id 'net.saliman.cobertura' version '2.2.5'
id 'com.github.kt3k.coveralls' version '2.0.1'
}
sourceCompatibility = 1.7
version = '0.0.1'
repositories {
mavenCentral()
maven{
url 'http://maven.restlet.org'
}
}
dependencies {
//compile dependencies
compile group: 'org.jetbrains', name: 'annotations', version: '13.0'
compile group: 'org.activiti', name: 'activiti-engine', version: '5.15.1'
compile group: 'org.activiti', name: 'activiti-spring', version: '5.15.1'
compile group: 'org.restlet.jee', name: 'org.restlet', version: '2.2.1'
compile group: 'org.restlet.jee', name: 'org.restlet.ext.spring', version: '2.2.1'
compile group: 'org.restlet.jee', name: 'org.restlet.ext.jackson', version: '2.2.1'
compile group: 'org.reflections', name: 'reflections', version: '0.9.8'
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.6'
//runtime dependencies
runtime group: 'mysql', name: 'mysql-connector-java', version: '5.1.31'
//test dependencies
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.springframework', name: 'spring-test', version: '3.2.7.RELEASE'
testCompile group: 'com.google.code.gson', name: 'gson', version: '2.3'
testRuntime group: 'com.h2database', name: 'h2', version: '1.4.178'
testRuntime group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
}
cobertura.coverageFormats = ['html', 'xml']
I've found the answer to my question but I've forgotten to post it here. My mistake came from using wrong coveralls plugin. This is what you need to use when faced with such a problem:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.0'
}
}
apply plugin: 'com.github.kt3k.coveralls'
You can see whole build.gradle that I've used here.

Resources