i have a set of code that is using gradle to run the back end server. I am running gradle :bootRun in my terminal. When i run it, it begins to process and then throws this huge error about file location. How can I fix this if i can even fix this.
Parallel execution is an incubating feature.
> Configure project :owf-example-widgets
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at build_cnhv1cccaip845qupsm2wplss.run(C:\Users\ojandali\Desktop\ozone-temp-goss\ozone-framework-server\owf-framework\owf-example-widgets\build.gradle:31)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'owf-framework'.
> Could not resolve all files for configuration ':runtime'.
> Could not find org.ozoneplatform:owf-appconfig:0.9.1-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-auditing:1.3.2-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-security:4.0.4-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-messaging:1.19.1-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
I am trying to figure out why the files are not being located or found.
UPDATE
this is the build.gradle file... I am trying to run gradle :bootRun
buildscript {
ext {
grailsVersion = '3.3.2'
gormVersion = '6.1.8.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.grails.org/grails/core' }
jcenter()
}
dependencies {
classpath group: 'io.spring.gradle', name: 'dependency-management-plugin', version: '1.0.4.RELEASE'
classpath group: 'org.grails', name: 'grails-gradle-plugin', version: grailsVersion
classpath group: 'org.grails.plugins', name: 'hibernate5', version: gormVersion - ".RELEASE"
classpath group: 'org.grails.plugins', name: 'database-migration', version: '3.0.3'
}
}
group 'org.ozoneplatform'
version '7.17.2-0'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'war'
apply plugin: 'org.grails.grails-web'
apply plugin: 'org.grails.grails-gsp'
ext {
releaseVersion = version.toString().replaceFirst("-", ".")
tomcatBundleStaging = "$buildDir/staging/bundle"
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo.grails.org/grails/core' }
maven { url 'http://repository.springsource.com/maven/bundles/release' }
maven { url 'http://repository.springsource.com/maven/bundles/external' }
maven { url 'https://packages.atlassian.com/3rdparty/' }
}
dependencyManagement {
imports {
mavenBom 'org.grails:grails-bom:' + grailsVersion
mavenBom 'org.ozoneplatform:ozone-classic-bom:7.17.2-0'
}
applyMavenExclusions false
}
grails {
plugins {
compile project(':owf-example-widgets')
}
}
configurations {
customTomcat {}
drivers {}
runtime.extendsFrom drivers
}
dependencies {
// Ozone
compile group: 'org.ozoneplatform', name: 'owf-appconfig', version: '0.9.1-0'
compile group: 'org.ozoneplatform', name: 'owf-auditing', version: '1.3.2-0'
compile group: 'org.ozoneplatform', name: 'owf-security', version: '4.0.4-0'
compile group: 'org.ozoneplatform', name: 'owf-messaging', version: '1.19.1-0'
customTomcat(group: 'org.ozoneplatform', name: 'owf-custom-tomcat', version: '1.2.3-0') {
artifact {
name = 'owf-custom-tomcat'
type = 'zip'
}
}
// Spring Boot
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
provided group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
// Grails
compile group: 'org.grails', name: 'grails-core'
compile group: 'org.grails', name: 'grails-web-boot'
compile group: 'org.grails', name: 'grails-logging'
compile group: 'org.grails', name: 'grails-plugin-rest'
compile group: 'org.grails', name: 'grails-plugin-databinding'
compile group: 'org.grails', name: 'grails-plugin-i18n'
compile group: 'org.grails', name: 'grails-plugin-services'
compile group: 'org.grails', name: 'grails-plugin-url-mappings'
compile group: 'org.grails', name: 'grails-plugin-interceptors'
compile group: 'org.grails.plugins', name: 'cache'
compile group: 'org.grails.plugins', name: 'cache-ehcache'
compile group: 'org.ehcache', name: 'ehcache'
compile group: 'org.grails.plugins', name: 'async'
compile group: 'org.grails.plugins', name: 'scaffolding'
compile group: 'org.grails.plugins', name: 'events'
compile group: 'org.grails.plugins', name: 'hibernate5'
compile group: 'org.grails.plugins', name: 'gsp'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind'
console group: 'org.grails', name: 'grails-console'
profile group: 'org.grails.profiles', name: 'web'
runtime group: 'org.glassfish.web', name: 'el-impl'
runtime group: 'com.h2database', name: 'h2'
runtime group: 'org.apache.tomcat', name: 'tomcat-jdbc'
drivers group: 'org.postgresql', name: 'postgresql'
testCompile group: 'org.grails', name: 'grails-gorm-testing-support'
testCompile group: 'org.grails', name: 'grails-web-testing-support'
testCompile group: 'org.grails', name: 'grails-datastore-rest-client'
testRuntime group: 'cglib', name: 'cglib-nodep'
// Grails Plugins
compile group: 'org.grails.plugins', name: 'converters'
compile group: 'org.grails.plugins', name: 'quartz'
compile group: 'org.grails.plugins', name: 'grails-pretty-time'
// Other
compile group: 'com.google.code.findbugs', name: 'jsr305'
compile group: 'org.hibernate', name: 'hibernate-core'
compile group: 'org.apache.httpcomponents', name: 'httpcore'
compile group: 'org.apache.httpcomponents', name: 'httpclient'
compile group: 'commons-fileupload', name: 'commons-fileupload'
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always',
'-Duser=testAdmin1',
'-Dowf.db.init',
'-Ddisable.auto.recompile=false',
'-Xverify:none')
addResources = false
}
war {
// Exclude the Spring .xml configuration files from the .war
// They will be copied to the Tomcat classpath at /tomcat/libs
rootSpec.exclude('ozone/framework/**')
}
idea {
module {
excludeDirs += file('archive')
excludeDirs += file('src/main/resources/public')
}
}
apply from: 'gradle/create-bundle.gradle'
apply from: 'gradle/report-test-coverage.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '4.2.1'
}
I cannot find
compile group: 'org.ozoneplatform', name: 'owf-appconfig', version: '0.9.1-0'
compile group: 'org.ozoneplatform', name: 'owf-auditing', version: '1.3.2-0'
compile group: 'org.ozoneplatform', name: 'owf-security', version: '4.0.4-0'
compile group: 'org.ozoneplatform', name: 'owf-messaging', version: '1.19.1-0'
on Maven Central, I suspect that is the issue, because that is
They seem to have different names, see:
https://search.maven.org/search?q=g:org.ozoneplatform
For example
compile group: 'org.ozoneplatform', name: 'ozone-security', version: '4.0.3'
should work.
It is also possible for you to build the missing dependencies yourself, for example by checking out this repository and doing a build:
https://github.com/ozoneplatform/owf-security
Related
I migrate my app from Spring Boot 1.5.22 to 2.7.0 and I have a problem. Java 8. To migrate to 2.0.0 I have to replace save () with saveAll (), replace the postgres driver: compile group: 'postgresql', name: 'postgresql', version: '9.1-901-1.jdbc4' with implementation ' org.postgresql: postgresql: 42.2.9 ', I also add this line to application.properties:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation = true. After that, I build without mistakes, but precisely: when I start shooting with Postman, with the correct token I get 401. (Before it was 200). When I started analyzing it, it turned out that after Spring migration, when the project is being built, postgres tables on localhost are created correctly, but they are empty, (that's why I get 401). I don't know how to work around it. Would you have an idea? I'm pasting build.gradle:
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE'
}
}
plugins {
id "io.franzbecker.gradle-lombok" version "1.11"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
project.version = '1.1.5'
jar {
baseName = 'refurbishment'
version = project.version
}
sourceSets {
util {
compileClasspath += sourceSets.main.runtimeClasspath
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven { url "http://projectlombok.org/mavenrepo" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.5.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version:'1.5.8.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-jwt', version:'1.1.1.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:'1.5.8.RELEASE'
implementation 'org.springframework.boot:spring-boot-properties-migrator:2.1.18.RELEASE'
testCompile 'org.springframework.boot:spring-boot-starter-test'
compile group: 'org.hibernate', name: 'hibernate-validator', version:'5.2.4.Final'
compile group: 'com.google.guava', name: 'guava', version:'16.0.1'
compile group: 'joda-time', name: 'joda-time', version:'2.8.2'
compile group: 'commons-lang', name: 'commons-lang', version:'2.6'
compile group: 'net.sf.ehcache', name: 'ehcache-core', version:'2.6.9'
implementation 'org.postgresql:postgresql:42.2.9'
compile group: 'io.jsonwebtoken', name: 'jjwt', version:'0.6.0'
compile group: 'org.projectlombok', name: 'lombok', version:'1.16.6'
compile group: 'org.apache.commons', name: 'commons-csv', version:'1.2'
compile group: 'com.google.code.gson', name: 'gson', version:'2.6.2'
compile group: 'commons-io', name: 'commons-io', version:'2.4'
compile group: 'org.json', name: 'json', version:'20160212'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.5.0'
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.5.0'
compile group: 'com.fasterxml', name: 'classmate', version:'1.3.1'
compile 'com.microsoft.azure:azure-storage:5.4.0'
runtime group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.3.4.jre8-preview'
compile files('libs/PDFjet-5.1.jar')
testCompile(group: 'junit', name: 'junit')
//DBUnit
testCompile 'org.dbunit:dbunit:2.5.3'
testCompile 'com.github.springtestdbunit:spring-test-dbunit:1.3.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version:'1.3'
testCompile group: 'org.assertj', name: 'assertj-core', version:'1.7.0'
testCompile(group: 'org.mockito', name: 'mockito-core', version:'1.10.19') {
exclude(module: 'hamcrest-core')
}
testCompile group: 'org.springframework', name: 'spring-test', version:'4.2.6.RELEASE'
testCompile group: 'com.jayway.jsonpath', name: 'json-path', version:'2.0.0'
testCompile group: 'com.jayway.jsonpath', name: 'json-path-assert', version:'0.9.1'
}
bootRun {
def profiles = findProperty('profiles')
if (profiles) {
args = ["--spring.profiles.active=" + profiles]
}
}
task copyWebConfig(type: Copy) {
from('src/main/templates') {
include 'web.config'
}
into "$buildDir/libs"
filter(ReplaceTokens, tokens: [VERSION: project.version])
inputs.property("VERSION", project.version)
}
assemble.dependsOn(copyWebConfig)
Solved :) Added spring.datasource.initialization-mode=always to application.properties (working for Spring Boot 2.0.0)
I am new to sonarqube and trying to execute a code scan on a java/jaxrs backend with gradle.
My build.gradle is the following:
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "4.4.5"
classpath group: "org.sonarsource.scanner.gradle", name:"sonarqube-gradle-plugin", version:"3.3"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "org.sonarqube"
apply plugin: "com.liferay.plugin"
dependencies {
compileOnly group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "org.osgi", name: "org.osgi.service.jaxrs", version: "1.0.0"
compile group: 'com.liferay', name: 'com.liferay.portal.remote.cors.api', version: '1.0.4'
compileInclude group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compileOnly group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.5'
compileOnly group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.9'
compileOnly group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5'
implementation group: 'com.liferay.portal', name: 'release.portal.api', version: '7.3.1-ga2'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
//
implementation group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.7.0'
testImplementation('org.junit.jupiter:junit-jupiter-api:5.4.2')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.4.2')
testCompile('org.junit.jupiter:junit-jupiter-params:5.4.2')
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.7.0'
testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.7.0'
testCompile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
testImplementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.5'
testImplementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.9'
testImplementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
task copyJar(type: Copy) {
from "build/libs"
into "../../../../files/osgi/modules/"
}
copyJar.dependsOn(build)
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
test {
useJUnitPlatform()
}
When I try to execute the sonar-scanner command from windows powershell or cmd:
.\gradlew sonarqube -Dsonar.projectKey=be_d254_enroll_center -Dsonar.host.url=http://localhost:9000 -Dsonar.login=1f774e64a98490b5e01646104342de340e40f263 -Dsonar.sources=src
I get the following error that points at another project be_256 different from the project from where I executed the command which is be_261
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/256/be_256'.
> Cannot add task 'downloadNode' as a task with that name already exists.
Config:
Sonarqube LTS 8.9.3
Gradle version 4.10.2
Java version 11
I tried to clear gradle cache but it did not work.
Any help is appreciated. Thanks.
Edit 1
I have been able to solve the previous error by completely uninstalling Gradle and re-installing it, I now have the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/261/be_261'.
> Could not resolve all artifacts for configuration ':LR/resident_services/d261_update_address/be_d261_update_address:classpath'.
> Could not download sonar-scanner-api.jar (org.sonarsource.scanner.api:sonar-scanner-api:2.16.1.361)
> Could not get resource 'https://repository-cdn.liferay.com/nexus/content/groups/public/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar'.
> Could not GET 'https://repository-cdn.liferay.com/nexus/content/groups/public/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar'.
> Received fatal alert: handshake_failure
Edit 2
I am once again stuck on this issue, I have tried once again to clear gradle's cache but it did not work
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/256/be_256'.
> Cannot add task 'downloadNode' as a task with that name already exists.
This issue was fixed after I moved the BE folder to another directory.
I'm running my gradle project with "gradle bootrun" on a cmd prompt window.
The error I get is this:
What went wrong:
A problem occurred configuring root project 'kyp4-backend'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/maven-metadata.xml <-- PRODUCES 404 ERROR when you go to page
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.4.0.BUILD-SNAPSHOT.pom <-- PRODUCES 404 ERROR when you go to page
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.4.0.BUILD-SNAPSHOT.jar <-- PRODUCES 404 ERROR when you go to page
Required by:
project :
************ GRADLE *****************
So here's my build.gradle file:
buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT") ***<-- THIS DOESN'T EXIST on repo.Spring.io. Only 1.2.0 = 5.x*** or ***<-- on repo.spring.io***
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'org.springframework.boot'
//apply plugin: 'war'
version = '0.0.1'
sourceCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
flatDir {
dirs 'repository'
}
mavenCentral()
}
ext {
springCloudVersion = 'Edgware.SR3'
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-devtools")
compile('org.springframework.boot:spring-boot-starter-actuator')
compile group: 'joda-time', name: 'joda-time'
compile group: 'com.myfolder', name: 'all_pfs', version: '7.1.9'
compile group: 'com.myfolder', name: 'pfs-client', version: '7.1.9'
compile group: 'com.myfolder.pfs.wic', name: 'pfs-wic', version: '1.1.0.RC3'
compile group: 'com.picketlink.picketlink', name: 'picketlink-fed', version: '2.0.3-SNAPSHOT'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'org.apache.httpcomponents', name: 'httpclient'
compile group: 'xstream', name: 'xstream', version: '1.2.2'
compile group: 'javax.ejb', name: 'javax.ejb-api', version: '3.2'
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.6.1'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.6.1'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.8.3'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.13'
compile group: 'org.springframework', name: 'spring-messaging', version: '4.2.6.RELEASE'
compile group: 'org.springframework', name: 'spring-websocket', version: '4.3.11.RELEASE'
compile('org.springframework.boot:spring-boot-starter-test')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.5.6.RELEASE'
testCompile group: 'com.microsoft.sqlserver', name: 'sqljdbc4', version: '4.0'
compile name: "sqljdbc4-4.0"
//Added to implement slf4j logger
compile group: 'org.slf4j', name:'slf4j-api', version: '1.7.2'
//compile group: 'ch.qos.logback', name:'logback-classic', version: '1.0.9'
//compile group: 'ch.qos.logback', name:'logback-core', version: '1.0.9'
// jsoup HTML parser library # https://jsoup.org/
compile 'org.jsoup:jsoup:1.11.3'
compile group: 'com.datastax.cassandra',name: 'cassandra-driver-core',version:'3.2.0'
compile('org.springframework.boot:spring-boot-starter-data-cassandra')
compile('org.projectlombok:lombok:1.18.2')
compile group: 'com.myfolder.service.fusion.audit.client', name: 'audit-client', version: '2.0.1.RELEASE'
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.3'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
But this is all starting with org.springframework.boot/.context/web.client does not exist:
Here's a couple images to show:
I deleted the Netbeans CACHE and let Netbeans rebuild projects and indicies... still, no joy!
Any help or insight would be greatly appreciated.
You have configured your buildscript to use Maven Central as its only repository:
repositories {
mavenCentral()
}
You have also configured it to depend on 1.4.0.BUILD-SNAPSHOT of Spring Boot's Gradle Plugin:
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT")
}
Snapshots are not published to Maven Central, only releases are published there. Milestones and snapshots are published to https://repo.spring.io. Specifically, snapshots are available from https://repo.spring.io/snapshot and milestones are available from https://repo.spring.io/milestone. You can find 1.4.0.BUILD-SNAPSHOT of Boot's Gradle plugin here.
If you want to use a snapshot version of Spring Boot, you should add https://repo.spring.io/snapshot and https://repo.spring.io/milestone to the configured repositories:
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
}
The milestone repository is required as a Spring Boot snapshot may have milestone dependencies.
Alternatively, and particularly given that 1.4.0 is rather old now and no longer supported, you may want to upgrade to a more recent release. At the time of writing, 1.5.17.RELEASE is the latest in the 1.x line and 2.1.0.RELEASE is the latest in the 2.x line.
You could upgrade to 1.5.17.RELEASE like this:
buildscript {
ext {
springBootVersion = '1.5.17.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}
I try to configure log4j2 to use MongoDB in a gradle project, when I run in Eclipse and my tests it's work fine, but When I generate a jar and start it I get a error:
2018-08-13 09:30:11,534 main ERROR Unable to locate plugin type for MongoDb
2018-08-13 09:30:11,548 main ERROR Unable to locate plugin for MongoDb
2018-08-13 09:30:11,597 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender for element NoSql: java.lang.NullPointerException java.lang.NullPointerException
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.findNamedNode(PluginElementVisitor.java:103)
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:87)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:181)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581)
at br.com.serversocket.main.Main.(Main.java:15)
2018-08-13 09:30:11,607 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender for element NoSql: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:235)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581)
at br.com.serversocket.main.Main.(Main.java:15)
2018-08-13 09:30:11,617 main ERROR Null object returned for NoSql in appenders.
2018-08-13 09:30:11,655 main ERROR Unable to locate appender "NoSql" for logger config "root"
my log4j2.yaml:
Configuration:
status: WARN
appenders:
NoSql:
name: NoSql
MongoDb:
databaseName: tracker
collectionName: appLog
server: ds261755.mlab.com
port: 61755
username: admin
password: XXXXX
Loggers:
logger:
-
name: com.memorynotfound
level: info
-
name: com.mchange.v2.c3p0
level: warn
Root:
level: info
AppenderRef:
ref: NoSql
my buil.gradle:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
archivesBaseName = 'ServerSocket'
version = '3.2.1'
mainClassName = 'br.com.serversocket.main.Main'
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
jar {
dependsOn 'test'
archiveName = "ServerSocket.jar"
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'br.com.serversocket.main.Main'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
test{
useJUnitPlatform()
dependsOn 'cleanTest'
testLogging {
events "passed", "skipped", "failed"
}
afterTest { desc, result ->
logger.quiet "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
testLogging {
exceptionFormat = 'full'
}
}
eclipse.classpath.file.whenMerged {
entries.each { println it.path }
}
configurations {
providedCompile
}
repositories {
mavenCentral()
mavenLocal()
}
ext {
jacksonVersion = '2.9.1'
hibernateVerison = '5.1.0.Final'
slf4jVerison = '1.7.25'
log4jVerison = '2.11.1'
junitVersion = '5.2.0'
emailVersion = '1.6.1'
}
dependencies {
//compile files(fileTree(dir: 'lib', includes: ['*.jar']))
compile "org.hibernate:hibernate-jpamodelgen:${hibernateVerison}"
compile "org.hibernate:hibernate-c3p0:${hibernateVerison}"
compile "org.hibernate:hibernate-core:${hibernateVerison}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVerison}"
compile "org.slf4j:slf4j-simple:${slf4jVerison}"
compile "org.slf4j:slf4j-api:${slf4jVerison}"
compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-api:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-core:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-nosql:2.9.1"
compile "org.apache.logging.log4j:log4j-jcl:${log4jVerison}"
compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"
compile "javax.mail:javax.mail-api:${emailVersion}"
compile "com.sun.mail:javax.mail:${emailVersion}"
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'
compile group: 'org.hibernate.common', name: 'hibernate-commons-annotations', version: '5.0.1.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
compile group: 'com.mchange', name: 'c3p0', version: '0.9.2.1'
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.1.0'
compile group: 'org.jboss.logging', name: 'jboss-logging', version: '3.3.1.Final'
compile group: 'commons-logging', name: 'commons-logging', version: '1.0.3'
compile group: 'org.apache.mina', name: 'mina-core', version: '2.0.19'
compile group: 'antlr', name: 'antlr', version: '2.7.7'
compile group: 'com.fasterxml', name: 'classmate', version: '1.3.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.6'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.1'
compile group: 'org.apache.commons', name: 'commons-email', version: '1.5'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.3'
compile group: 'commons-discovery', name: 'commons-discovery', version: '0.2'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'net.sf.ehcache', name: 'ehcache', version: '1.5.0'
compile group: 'org.apache.geronimo.specs', name: 'geronimo-jta_1.1_spec', version: '1.1.1'
compile group: 'org.jboss', name: 'jandex', version: '2.0.3.Final'
compile group: 'org.javassist', name: 'javassist', version: '3.22.0-GA'
compile group: 'jdom', name: 'jdom', version: '1.1'
compile group: 'javax.transaction', name: 'jta', version: '1.1'
compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
compile group: 'org.apache.axis', name: 'axis', version: '1.4'
compile group: 'axis', name: 'axis-jaxrpc', version: '1.4'
compile group: 'javax.xml.soap', name: 'saaj-api', version: '1.3'
compile group: 'wsdl4j', name: 'wsdl4j', version: '1.6.2'
compile group: 'com.mchange', name: 'mchange-commons-java', version: '0.2.3.4'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.8.0'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.2.0'
}
configurations {
all*.exclude group: 'javassist', module: 'javassist'
}
My problem is in configuration? What I need to do?
[EDITED]
I change some configurations:
build.gradle:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
archivesBaseName = 'ServerSocket'
version = '3.2.1'
mainClassName = 'br.com.serversocket.main.Main'
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
jar {
//dependsOn 'test'
archiveName = "ServerSocket.jar"
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'br.com.serversocket.main.Main'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
test{
useJUnitPlatform()
dependsOn 'cleanTest'
testLogging {
events "passed", "skipped", "failed"
}
afterTest { desc, result ->
logger.quiet "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
testLogging {
exceptionFormat = 'full'
}
}
eclipse.classpath.file.whenMerged {
entries.each { println it.path }
}
configurations {
providedCompile
}
repositories {
mavenCentral()
mavenLocal()
}
ext {
jacksonVersion = '2.9.1'
hibernateVerison = '5.1.0.Final'
slf4jVerison = '1.7.25'
log4jVerison = '2.11.1'
junitVersion = '5.2.0'
emailVersion = '1.6.1'
mongoDBVersion = '3.8.0'
}
dependencies {
//compile files(fileTree(dir: 'lib', includes: ['*.jar']))
compile "org.hibernate:hibernate-jpamodelgen:${hibernateVerison}"
compile "org.hibernate:hibernate-c3p0:${hibernateVerison}"
compile "org.hibernate:hibernate-core:${hibernateVerison}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVerison}"
compile "org.slf4j:slf4j-simple:${slf4jVerison}"
compile "org.slf4j:slf4j-api:${slf4jVerison}"
compile "org.apache.logging.log4j:log4j-api:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-core:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-jcl:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-mongodb3:${log4jVerison}"
//compile "org.apache.logging.log4j:log4j-nosql:${log4jVerison}"
compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"
compile "javax.mail:javax.mail-api:${emailVersion}"
compile "com.sun.mail:javax.mail:${emailVersion}"
//compile "org.mongodb:mongo-java-driver:${mongoDBVersion}"
compile "org.mongodb:mongodb-driver:${mongoDBVersion}"
compile "org.mongodb:mongodb-driver-core:${mongoDBVersion}"
compile "org.mongodb:bson:${mongoDBVersion}"
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'
compile group: 'org.hibernate.common', name: 'hibernate-commons-annotations', version: '5.0.1.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
compile group: 'com.mchange', name: 'c3p0', version: '0.9.2.1'
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.1.0'
compile group: 'org.jboss.logging', name: 'jboss-logging', version: '3.3.1.Final'
compile group: 'commons-logging', name: 'commons-logging', version: '1.0.3'
compile group: 'org.apache.mina', name: 'mina-core', version: '2.0.19'
compile group: 'antlr', name: 'antlr', version: '2.7.7'
compile group: 'com.fasterxml', name: 'classmate', version: '1.3.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.6'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.1'
compile group: 'org.apache.commons', name: 'commons-email', version: '1.5'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.3'
compile group: 'commons-discovery', name: 'commons-discovery', version: '0.2'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'net.sf.ehcache', name: 'ehcache', version: '1.5.0'
compile group: 'org.apache.geronimo.specs', name: 'geronimo-jta_1.1_spec', version: '1.1.1'
compile group: 'org.jboss', name: 'jandex', version: '2.0.3.Final'
compile group: 'org.javassist', name: 'javassist', version: '3.22.0-GA'
compile group: 'jdom', name: 'jdom', version: '1.1'
compile group: 'javax.transaction', name: 'jta', version: '1.1'
compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
compile group: 'org.apache.axis', name: 'axis', version: '1.4'
compile group: 'axis', name: 'axis-jaxrpc', version: '1.4'
compile group: 'javax.xml.soap', name: 'saaj-api', version: '1.3'
compile group: 'wsdl4j', name: 'wsdl4j', version: '1.6.2'
compile group: 'com.mchange', name: 'mchange-commons-java', version: '0.2.3.4'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.2.0'
}
configurations {
all*.exclude group: 'javassist', module: 'javassist'
}
log4j2.yaml:
Configuration:
status: WARN
appenders:
NoSql:
name: databaseAppender
MongoDb3:
databaseName: tracker
collectionName: appLog
server: ds261755.mlab.com
port: 61755
username: admin
password: xxxx
Loggers:
logger:
-
name: com.memorynotfound
level: info
-
name: com.mchange.v2.c3p0
level: warn
Root:
level: info
AppenderRef:
ref: databaseAppender
and I get a new error message:
2018-08-14 10:29:26,690 main ERROR Unable to locate plugin type for MongoDb3
2018-08-14 10:29:26,703 main ERROR Unable to locate plugin for MongoDb3
2018-08-14 10:29:26,753 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender for element NoSql: java.lang.NullPointerException java.lang.NullPointerException
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.findNamedNode(PluginElementVisitor.java:103)
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:87)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:181)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581)
at br.com.serversocket.main.Main.<clinit>(Main.java:15)
2018-08-14 10:29:26,764 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender for element NoSql: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.nosql.NoSqlAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:235)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581)
at br.com.serversocket.main.Main.<clinit>(Main.java:15)
2018-08-14 10:29:26,773 main ERROR Null object returned for NoSql in appenders.
2018-08-14 10:29:26,813 main ERROR Unable to locate appender "databaseAppender" for logger config "root"
I inspected class' log4j-core to try understend better about the error and found this method:
protected void preConfigure(final Node node) {
try {
for (final Node child : node.getChildren()) {
if (child.getType() == null) {// problem happen here in production
LOGGER.error("Unable to locate plugin type for " + child.getName());
continue;
}
final Class<?> clazz = child.getType().getPluginClass();
if (clazz.isAnnotationPresent(Scheduled.class)) {
configurationScheduler.incrementScheduledItems();
}
preConfigure(child);
}
} catch (final Exception ex) {
LOGGER.error("Error capturing node data for node " + node.getName(), ex);
}
}
When I run project in IDE a node's property "getType()" is "PluginType [pluginClass=class org.apache.logging.log4j.mongodb3.MongoDbProvider, key=mongodb3, elementName=MongoDb3, isObjectPrintable=true, isDeferChildren==false, category=core]"
but I production, I suppose how the jar not found a class inside log4j-mongodb3.
I inspect generated jar, but the class was packaged without problems. what is happen ?
[EDITED]
I found my problem, I created a test project without gradle and I generated a jar, I need to copy dependencies and not extract they, how can I configure gradle to do it in jar task ?
I solved my problem using 2 gradle's plugin:
shadow:
http://imperceptiblethoughts.com/shadow/#shadowing_gradle_plugins
and this plugin to fix a incompability with log4j:
https://github.com/TheBoegl/shadow-log4j-transformer#using-the-gradle-plugin-dsl
follow my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
classpath 'de.sebastianboegl.gradle.plugins:shadow-log4j-transformer:2.2.0'
}
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow'
archivesBaseName = 'ServerSocket'
version = '3.2.1'
mainClassName = 'br.com.serversocket.main.Main'
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
shadowJar {
//dependsOn 'test'
transform(de.sebastianboegl.gradle.plugins.shadow.transformers.Log4j2PluginsFileTransformer)
archiveName = "ServerSocket.jar"
manifest {
attributes 'Main-Class': 'br.com.serversocket.main.Main'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
jar {
//dependsOn 'test'
archiveName = "ServerSocket.jar"
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'br.com.serversocket.main.Main'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
test{
useJUnitPlatform()
dependsOn 'cleanTest'
testLogging {
events "passed", "skipped", "failed"
}
afterTest { desc, result ->
logger.quiet "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
testLogging {
exceptionFormat = 'full'
}
}
eclipse.classpath.file.whenMerged {
entries.each { println it.path }
}
configurations {
providedCompile
}
repositories {
mavenCentral()
mavenLocal()
}
ext {
jacksonVersion = '2.9.1'
hibernateVerison = '5.1.0.Final'
slf4jVerison = '1.7.25'
log4jVerison = '2.11.1'
junitVersion = '5.2.0'
emailVersion = '1.6.1'
mongoDBVersion = '3.8.0'
}
dependencies {
//compile files(fileTree(dir: 'lib', includes: ['*.jar']))
compile "org.hibernate:hibernate-jpamodelgen:${hibernateVerison}"
compile "org.hibernate:hibernate-c3p0:${hibernateVerison}"
compile "org.hibernate:hibernate-core:${hibernateVerison}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVerison}"
compile "org.slf4j:slf4j-simple:${slf4jVerison}"
compile "org.slf4j:slf4j-api:${slf4jVerison}"
compile "org.apache.logging.log4j:log4j-api:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-core:${log4jVerison}"
compile "org.apache.logging.log4j:log4j-mongodb3:${log4jVerison}"
compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"
compile "javax.mail:javax.mail-api:${emailVersion}"
compile "com.sun.mail:javax.mail:${emailVersion}"
compile "org.mongodb:mongodb-driver:${mongoDBVersion}"
compile "org.mongodb:mongodb-driver-core:${mongoDBVersion}"
compile "org.mongodb:bson:${mongoDBVersion}"
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'
compile group: 'org.hibernate.common', name: 'hibernate-commons-annotations', version: '5.0.1.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
compile group: 'com.mchange', name: 'c3p0', version: '0.9.2.1'
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.1.0'
compile group: 'org.jboss.logging', name: 'jboss-logging', version: '3.3.1.Final'
compile group: 'commons-logging', name: 'commons-logging', version: '1.0.3'
compile group: 'org.apache.mina', name: 'mina-core', version: '2.0.19'
compile group: 'antlr', name: 'antlr', version: '2.7.7'
compile group: 'com.fasterxml', name: 'classmate', version: '1.3.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.6'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.1'
compile group: 'org.apache.commons', name: 'commons-email', version: '1.5'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.3'
compile group: 'commons-discovery', name: 'commons-discovery', version: '0.2'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'net.sf.ehcache', name: 'ehcache', version: '1.5.0'
compile group: 'org.apache.geronimo.specs', name: 'geronimo-jta_1.1_spec', version: '1.1.1'
compile group: 'org.jboss', name: 'jandex', version: '2.0.3.Final'
compile group: 'org.javassist', name: 'javassist', version: '3.22.0-GA'
compile group: 'jdom', name: 'jdom', version: '1.1'
compile group: 'javax.transaction', name: 'jta', version: '1.1'
compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
compile group: 'org.apache.axis', name: 'axis', version: '1.4'
compile group: 'axis', name: 'axis-jaxrpc', version: '1.4'
compile group: 'javax.xml.soap', name: 'saaj-api', version: '1.3'
compile group: 'wsdl4j', name: 'wsdl4j', version: '1.6.2'
compile group: 'com.mchange', name: 'mchange-commons-java', version: '0.2.3.4'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.2.0'
}
configurations {
all*.exclude group: 'javassist', module: 'javassist'
}
I have a war project (project A) that has a compile dependency on another project that contains shared libraries (project B), however I don't want the transitive dependencies of the project B to be included on the WTP deployment.
When I generate the war file using gradle the transitive dependencies from Project B are ignored as I want to, however WTP keeps copying all libs into the /WEB-INF/lib directory and therefore I have classloader issues.
I have tried to to ignore transitive dependencies from Project B using transitive = false and ignoring specific dependencies with exclude both at dependency and configuration level with not success so far and I can't find what I'm doing wrong.
Thanks in advance.
My configuration is as follows:
Project A
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'
repositories {
mavenLocal()
mavenCentral()
maven { // ext release
url "${artifactory_contextUrl}/ext-release-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // libs release
url "${artifactory_contextUrl}/libs-release-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // libs snapshot
url "${artifactory_contextUrl}/libs-snapshot-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases
url "http://repository.springsource.com/maven/bundles/release" }
maven { // SpringSource Enterprise Bundle Repository - External Bundle Releases
url "http://repository.springsource.com/maven/bundles/external" }
maven { // SpringSource Enterprise Bundle Repository - SpringSource Library Releases
url "http://repository.springsource.com/maven/libraries/release" }
maven { // SpringSource Enterprise Bundle Repository - External Library Releases
url "http://repository.springsource.com/maven/libraries/external" }
}
group = 'com.thisproject'
sourceCompatibility = '1.6'
version = '1.6'
war {
baseName = 'ROOT'
archiveName = baseName+'.'+extension
destinationDir = file('build/')
}
task deployToFolder(dependsOn: 'war') << {
copy {
from war.archivePath
into "${deployFolder}"
}
}
task jenkinsTest{
inputs.files test.outputs.files
doLast{
def timestamp = System.currentTimeMillis()
test.testResultsDir.eachFile { it.lastModified = timestamp }
}
}
build.dependsOn(jenkinsTest)
configurations {
runtime.exclude group: 'commons-validator', module: 'commons-validator'
runtime {
transitive = false
}
}
dependencies{
providedCompile group: 'log4j', name: 'log4j', version: '1.2.16'
providedCompile group: 'org.springframework.security', name: 'org.springframework.security.web', version: '3.1.1.RELEASE'
providedCompile group: 'org.springframework.security', name: 'spring-security-config', version: '3.1.1.RELEASE'
providedCompile group: 'org.springframework.social', name: 'spring-social-web', version: '1.0.2.RELEASE'
providedCompile group: 'org.springframework.social', name: 'spring-social-core', version: '1.0.2.RELEASE'
providedCompile group: 'org.springframework.social', name: 'spring-social-facebook', version: '1.0.1.RELEASE'
providedCompile group: 'org.springframework.social', name: 'spring-social-twitter', version: '1.0.2.RELEASE'
providedCompile group: 'spring-social-google', name: 'spring-social-google', version: '1.0'
providedCompile group: 'jstl', name: 'jstl', version: '1.2'
providedCompile group: 'org.springframework.security', name:'org.springframework.security.taglibs', version:'3.1.1.RELEASE'
compile(project(':projectB')) {
exclude module:'commons-validator'
transitive = false
}
providedCompile group: 'javax.servlet', name: 'servlet-api', version: '2.5'
providedCompile group: 'javax.servlet', name: 'jsp-api', version: '2.0'
providedCompile group: 'org.springframework', name: 'org.springframework.transaction', version: '3.1.1.RELEASE'
providedCompile group: 'commons-validator', name: 'commons-validator', version: '1.2.0'
providedCompile group: 'commons-lang', name: 'commons-lang', version: '2.4'
providedCompile group: 'javax.validation', name: 'validation-api', version: '1.0.0.GA'
providedCompile 'javax.persistence:persistence-api:1.0.2'
providedCompile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.10.Final'
}
eclipse {
project { natures 'org.springsource.ide.eclipse.gradle.core.nature' }
wtp {
component { deployName = 'ROOT' }
facet {
facet name: 'jst.web', version: '2.5'
facet name: 'jst.java', version: '1.6'
}
}
}
compileJava {
options.encoding = "UTF-8"
}
Project B
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
repositories {
mavenLocal()
mavenCentral()
maven { // ext release
url "${artifactory_contextUrl}/ext-release-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // libs release
url "${artifactory_contextUrl}/libs-release-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // libs snapshot
url "${artifactory_contextUrl}/libs-snapshot-local"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
maven { // SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases
url "http://repository.springsource.com/maven/bundles/release"
}
maven { // SpringSource Enterprise Bundle Repository - External Bundle Releases
url "http://repository.springsource.com/maven/bundles/external"
}
maven { // SpringSource Enterprise Bundle Repository - SpringSource Library Releases
url "http://repository.springsource.com/maven/libraries/release"
}
maven { // SpringSource Enterprise Bundle Repository - External Library Releases
url "http://repository.springsource.com/maven/libraries/external"
}
}
group = 'com.thisproject'
sourceCompatibility = '1.6'
version = '1.7.26-SNAPSHOT'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
}
destinationDir = file('build/')
}
task deployToFolder(dependsOn: 'jar') << {
copy {
from jar.archivePath
into "${deployFolder}"
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
dependencies{
compile group: 'log4j', name: 'log4j', version: '1.2.16'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
compile group: 'com.lowagie', name: 'itext', version: '2.0.8'
compile group: 'commons-codec', name: 'commons-codec', version: '1.6'
compile group: 'commons-lang', name: 'commons-lang', version: '2.4'
compile group: 'commons-io', name: 'commons-io', version: '1.4'
compile group: 'commons-validator', name: 'commons-validator', version: '1.2.0'
compile group: 'org.apache.axis', name: 'axis-jaxrpc', version: '1.4'
compile group: 'com.esendex', name: 'esendex.sdk', version: '1.0'
compile group: 'org.apache.lucene', name: 'lucene-core', version: '1.9.1'
compile group: 'org.apache.lucene', name: 'lucene-snowball', version: '1.9.1'
compile group: 'com.sun.jersey', name: 'jersey-client', version: '1.12'
compile group: 'com.sun.jersey', name: 'jersey-json', version: '1.12'
compile group: 'com.sun.jersey.ri', name: 'jax-rs-ri', version: '1.12'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.2'
compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.10.Final'
compile group: 'org.hibernate', name: 'hibernate-validator', version: '4.3.1.Final'
compile group: 'org.springframework', name: 'org.springframework.aop', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.beans', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.context', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.jdbc', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.orm', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.oxm', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.transaction', version: '3.1.1.RELEASE'
compile group: 'org.springframework', name: 'org.springframework.web.servlet', version: '3.1.1.RELEASE'
compile group: 'spring-social-jpa', name: 'spring-social-jpa', version: '0.0.1'
compile group: 'javax.xml.bind', name: 'jsr173_api', version: '1.0'
compile group: 'javax.validation', name: 'validation-api', version: '1.0.0.GA'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '4.1'
compile group: 'axis', name: 'axis', version: '1.4'
compile group: 'org.apache.commons', name: 'commons-email', version: '1.2'
compile group: 'org.apache.tomcat', name: 'catalina', version: '6.0.35'
compile group: 'javax.servlet', name: 'servlet-api', version: '2.5'
compile group: 'javax.servlet', name: 'jsp-api', version: '2.0'
compile group: 'org.springframework.security', name: 'org.springframework.security.web', version: '3.1.1.RELEASE'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.0.1'
compile group: 'net.sf.opencsv', name: 'opencsv', version: '2.0'
testCompile 'junit:junit:4.11'
testCompile group: 'org.springframework', name: 'org.springframework.test', version: '3.1.1.RELEASE'
testCompile 'mysql:mysql-connector-java:5.1.22'
testCompile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.10.Final'
testCompile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '3.6.10.Final'
testCompile 'org.hibernate:hibernate-validator:4.3.1.Final'
compile(group: 'com.paypal.sdk', name: 'merchantsdk', version: '2.2.98')
compile(group: 'com.paypal.sdk', name: 'paypal-core', version: '1.1.1')
}
compileJava {
options.encoding = "UTF-8"
}
After a massive search through net and digging into so many Gradle and WTP stuff, I was able to get this working. Basically, there are three ways to ignore dependencies in WTP deploy directory (or I am aware of only three of them!).
1. Setting transitive to false
As you have mentioned in the question and the syntax is like:
compile('group.id:jar.name:1.0') {transitive = false}
runtime('group.id:jar.name:1.0') {transitive = false}
This should prevent the dependant JARs of being added to final WTP directory.
2. Excluding using provided syntax
Gadle comes with a feature to prevent dependencies of being added to final WAR file which in here can be used to prevent them of being copied to WTP deploy dir. And here is the syntax:
providedCompile 'group.id:jar.name:1.0'
providedRuntime 'group.id:jar.name:1.0'
3. HACK!!
Here comes the most interesting part. What if none of the above works? I found this thread on STS jira which is about same issue and that pointed me to this solution which did not work for me but gave me a clue to do my own hack as follow. In the build script I added following code to ignore the dependencies manually:
subprojects {
project.afterEvaluate {
eclipse.classpath.file.withXml {
it.asNode().'classpathentry'.each { entry ->
def path = entry.#path.toLowerCase()
if (path.contains('your-jar-to-ignore')) {
entry.attributes.each { attr ->
if (attr.attribute.#name.contains('org.eclipse.jst.component.dependency')) {
entry.remove(attr)
}
}
}
}
}
}
}
It hacks into the process of generating .classpath file (which is done by gradle) and prevents it of adding dependency attribute to the specified JAR. This way it doesn't get copied to WTP deploy directory.
Hope this helps people who land on this page, but I really think either Eclipse or Gradle people should fix this issue as it is very frustrating.