Ignore gradle transitive project dependencies using eclipse WTP - java

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.

Related

Spring Boot migration from 1.5.22 to 2.0.0

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)

Gradle file locating issue

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

Trying to compile with gradle bootrun and get cannot find spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT

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")
}
}

Deorg.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

I'm using the Xerces jar in a gradle project, I use then the jar of this project inside a gradle plugin: In fact, I'm developing a gradle plugin with custom tasks that use some functions of the gradle project jar; when I try to run the tasks, I have this error; however when I try to run the function from the gradle project it works correctly. When I tried to search on the net, I found that the cause of the error is that the JRE packages a version of Xerces but I don't know how to resolve the problem...
dependencies block of my gradle project:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
dependencies {
testImplementation 'junit:junit:4.12'
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
implementation (group: 'commons-logging', name: 'commons-logging', version: '1.2')
implementation(group: 'log4j', name: 'log4j', version: '1.2.17')
implementation (group: 'javax', name: 'javaee-api', version: '8.0')
implementation group: 'org.hibernate', name: 'hibernate-core', version: '5.2.17.Final'
implementation (group: 'commons-io', name: 'commons-io', version: '2.6')
implementation(group: 'org.apache.ant', name: 'ant', version: '1.10.3')
implementation( group: 'xerces', name: 'xercesImpl', version: '2.11.0')
implementation (group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3')
implementation( group: 'net.sf.jt400', name: 'jt400', version: '9.5')
implementation(group: 'mysql', name: 'mysql-connector-java', version: '5.0.4')
implementation (group: 'org.apache.derby', name: 'derbyclient', version: '10.14.2.0')
implementation group: 'com.oracle', name: 'ojdbc6', version: '11.2.0.3'
implementation group: 'Ext', name: 'sqljdbc', version: 'sqljdbc'
implementation group: 'toplink.essentials', name: 'toplink-essentials', version: '2.1-60',transitive:false
implementation group: 'org.springframework', name: 'spring', version: '2.5.6'
implementation group: 'org.swinglabs', name: 'swing-layout', version: '1.0.3'
implementation group: 'xalan', name: 'xalan', version: '2.7.2'
implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.6.6'
implementation group: 'org.gradle', name: 'gradle-tooling-api', version: '4.3'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'org.hibernate', name: 'hibernate-cglib-repack', version: '2.1_3'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
implementation group: 'xml-apis', name: 'xml-apis', version: '1.4.01'
implementation (group: 'xalan', name: 'serializer', version: '2.7.2')
implementation(group:'org.apache.ant', name: 'ant-launcher', version: '1.10.3')
}
Here is the Build.gradle of my gradle plugin:
group = 'CustomPlugin'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
archivesBaseName ='CustomPluginGradle'
version='10.0.0'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'repo-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publishConfigs('archives', 'published')
publishBuildInfo = false
publishArtifacts = false
publishPom = true
publishIvy = false
}
}
resolve {
repository {
repoKey = 'repo-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
CustomPluginGradle(MavenPublication) {
group='CustomPlugin'
}
}
}
jar {
from ('src/main/java'){
exclude '**/**.java'}
}
repositories {
jcenter()
}
dependencies {
compile gradleApi()
testImplementation 'junit:junit:4.12'
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
implementation (group: 'commons-logging', name: 'commons-logging', version: '1.2')
implementation(group: 'log4j', name: 'log4j', version: '1.2.17')
implementation (group: 'javax', name: 'javaee-api', version: '8.0')
implementation group: 'org.hibernate', name: 'hibernate-core', version: '5.2.17.Final'
implementation (group: 'commons-io', name: 'commons-io', version: '2.6')
implementation(group: 'org.apache.ant', name: 'ant', version: '1.10.3')
implementation( group: 'xerces', name: 'xercesImpl', version: '2.11.0')
implementation (group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3')
implementation( group: 'net.sf.jt400', name: 'jt400', version: '9.5')
implementation(group: 'mysql', name: 'mysql-connector-java', version: '5.0.4')
implementation (group: 'org.apache.derby', name: 'derbyclient', version: '10.14.2.0')
implementation group: 'com.oracle', name: 'ojdbc6', version: '11.2.0.3'
implementation group: 'Ext', name: 'sqljdbc', version: 'sqljdbc'
implementation group: 'toplink.essentials', name: 'toplink-essentials', version: '2.1-60',transitive:false
implementation group: 'org.springframework', name: 'spring', version: '2.5.6'
implementation group: 'org.swinglabs', name: 'swing-layout', version: '1.0.3'
implementation group: 'xalan', name: 'xalan', version: '2.7.2'
implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.6.6'
implementation group: 'org.gradle', name: 'gradle-tooling-api', version: '4.3'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'org.hibernate', name: 'hibernate-cglib-repack', version: '2.1_3'
implementation group: 'xml-apis', name: 'xml-apis', version: '1.4.01'
implementation (group: 'xalan', name: 'serializer', version: '2.7.2')
implementation(group:'org.apache.ant', name: 'ant-launcher', version: '1.10.3')
}
configurations.all {
transitive = false
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
It a conflict between your version of Xerces 2.11.0 and a version brought through a transitive dependency. Try this :
configurations.all {
resolutionStrategy {
force 'xerces:xercesImpl:2.11.0'
}
}

Publish WAR file to Maven Repo using Gradle

I have a Parent Module Gradle project which contains sub-projects. One of those sub-projects is a web application. When I'm publishing to the maven repo, it is published as ONLY the jar file despite having both jar and war created locally
Parent file Gradle settings:
configurations {
integTestCompile.extendsFrom testCompile
integTestRuntime.extendsFrom testRuntime
}
allprojects {
ext {
springVersion = "4.0.4.RELEASE"
}
tasks.withType(JavaCompile) {
sourceCompatibility = "1.6"
targetCompatibility = "1.6"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
repositories {
maven {
url "http://.../mirror/"
}
}
publishing {
publications {
maven(MavenPublication) {
groupId 'com.blah'
version '1.2'
from components.java
}
}
repositories {
maven {
credentials {
username ""
password ""
}
if(project.version.endsWith('-SNAPSHOT')) {
url "http://.../snapshots/"
} else {
url "http:/.../internal/"
}
}
}
}
dependencies {
testCompile 'junit:junit:4.8.2'
}
}
And the web application gradle
apply plugin: 'war'
configurations {
providedRuntime
}
war {
baseName = 'portal-web'
}
dependencies {
compile(project(":portal-web-breadcrumb"))
compile(project(":portal-entity"))
compile(group: 'commons-beanutils', name: 'commons-beanutils', version: '20030211.134440')
compile(group: 'commons-digester', name: 'commons-digester', version: '2.1')
compile(group: 'org.apache.tiles', name: 'tiles-api', version: '3.0.1')
compile(group: 'org.apache.tiles', name: 'tiles-core', version: '3.0.1')
compile(group: 'org.apache.tiles', name: 'tiles-jsp', version: '3.0.1')
compile(group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5')
compile(group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7.5')
compile(group: 'javax.servlet', name: 'jstl', version: '1.2')
compile(group: 'taglibs', name: 'standard', version: '1.1.2')
compile(group: 'org.springframework', name: 'spring-core', version: "$springVersion")
compile(group: 'org.springframework', name: 'spring-web', version: "$springVersion")
compile(group: 'org.springframework', name: 'spring-webmvc', version: "$springVersion")
compile(group: 'log4j', name: 'log4j', version: '1.2.15') {
exclude group: 'javax.mail', module: 'mail'
exclude group: 'javax.jms', module: 'jms'
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
}
providedCompile('javax.servlet:javax.servlet-api:3.1.0')
providedCompile(group: 'javax.servlet', name: 'jsp-api', version: '2.0')
providedCompile(group: 'javax', name: 'javaee-api', version: '6.0')
}
Thanks
For publishing a War, configure the MavenPublication with from components.web.
Add this under your publishing:
publications {
mavenWeb(MavenPublication) {
from components.web
}
}

Categories