Problem with connecting robovm-rt library - spring

When I connect the new library robovm-rt, gradle swears that I already have several such classes in another library:
Duplicate class org.apache.commons.logging.Log found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.LogFactory found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.LogFactory$1 found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
I tried to exclude these Apache classes from library in different ways, but none of them work, the problem remains. Not working options:
Option 1:
implementation (group: 'com.mobidevelop.robovm', name: 'robovm-rt', version: '2.3.5') {
exclude group: 'commons-logging', module: 'commons-logging'
}
Option 2:
implementation (group: 'com.mobidevelop.robovm', name: 'robovm-rt', version: '2.3.5') {
exclude group: 'org.apache.commons', module: 'commons-logging'
}
What is the correct way to exclude these classes so that they are not duplicated?

Answering my question, I just excluded the module not from the first library, but from the second one - spring-boot-starter-websocket
implementation('org.springframework.boot:spring-boot-starter-websocket') {
exclude group: 'org.springframework', module: 'spring-jcl'
}

Related

Liferay 7.2 No value has been specified for property 'apiDir'

I created a module project using servicebuild template (gradebook-api, gradebook-service), but i have an error after an export package com.liferay.training.gradebook.validator in api below
Bundle-Name: gradebook-api
Bundle-SymbolicName: com.liferay.training.gradebook.api
Bundle-Version: 1.0.0
Export-Package: \
com.liferay.training.gradebook.exception,\
com.liferay.training.gradebook.model,\
com.liferay.training.gradebook.service,\
com.liferay.training.gradebook.service.persistence,\
com.liferay.training.gradebook.validator
-check: EXPORTS
-includeresource: META-INF/service.xml=../gradebook-service/service.xml
i have a problem in the BuildService gradle task that's says :
Some problems were found with the configuration of task
':modules:gradebook:gradebook-api:buildService' (type
'BuildServiceTask').
File 'C:\Liferay\ide-workspace\training-workspace\modules\gradebook\gradebook-api\service.xml'
specified for property 'inputFile' does not exist.
No value has been specified for property 'apiDir'.
And this is a how I add the api module as dependency in service.
dependencies {
compileOnly group: "com.liferay", name: "com.liferay.petra.io"
compileOnly group: "com.liferay", name: "com.liferay.petra.lang"
compileOnly group: "com.liferay", name: "com.liferay.petra.string"
compileOnly group: "com.liferay", name: "com.liferay.portal.aop.api"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
compileOnly group: "org.osgi", name: "org.osgi.annotation.versioning"
compileOnly group: "org.osgi", name: "org.osgi.core"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
compileOnly group: "javax.portlet", name: "portlet-api"
compileOnly group: "javax.servlet", name: "javax.servlet-api"
compile project(":modules:gradebook:gradebook-api")
}
buildService {
apiDir = "../gradebook-api/src/main/java"
}
group = "com.liferay.training.gradebook"
I am trying to create new Liferay workspace but i got the same error (May be this is an error with Gradle)
Be sure, you run gradle task in the corresponding folder (in gradebook-service folder). I got similar error when I ran it in upper folder which contains api and service folder.
Until recently I have only worked on LR 7.0, but the last day or so have been playing with 7.3. I encountered the exact issue you describe.
The only solution I found was to copy service.xml from gradebook-service into the root of both my gradebook-api and gradebook-web modules and also add the following to the build.gradle files of both the gradebook-api and gradebook-web modules:
buildService {
apiDir = "../gradebook-api/src/main/java"
}
After that service builder ran successfully. There may be a cleaner way around it, but this worked for me.
service.xml should stay in service module only. Here, it look you need few checks.
api module dependency should be compileonly. not in compile
scope.
block order also matters in gradle file. move below block
at the top of the file.
buildService {
apiDir = "../gradebook-api/src/main/java"
}
not sure why you need -check:exports header in bnd file. As, that is not required normally.
In the Gradle task tab, go to your specific module service folder and then build it from there. Don't forget to refresh your gradle by pressing Cntrl+F5.
This Worked for me.
I had the same situation and just added the buildService{...} in build.gradle in the api module.
buildService {
apiDir = "../gradebook-api/src/main/java"
}
After: BUILD SUCCESSFUL

Unable to load class grails.plugins.rendering.image.ImageRenderingService Grails 4 Rendering:2.03

I am trying to use the plugin rendering:2.0.3 in grails 4 but i get the compilation error:
Unable to load class grails.plugins.rendering.image.ImageRenderingService
The solution was to add the missing clasess in the file build.gradle
compile group: 'org.xhtmlrenderer', name: 'flying-saucer-core', version: '9.1.6' //class org.xhtmlrenderer.simple.Graphics2DRenderer
compile group: 'io.github.msalaslo', name: 'flying-saucer-pdf', version: '9.1.20' //class org/xhtmlrenderer/pdf/ITextRenderer
compile 'org.grails.plugins:rendering:2.0.3'
thanks to the website for providing it
https://jar-download.com/artifacts/org.xhtmlrenderer/flying-saucer-core/9.1.8/source-code/org/xhtmlrenderer/simple/Graphics2DRenderer.java

How to exclude specific jars when using gradle in IntelliJ

I think there is a function to exculde from the pop-up menu by right-clicking on the screen below.
And I added my own build.gradle like below, but the dependency I want is not removed.
dependencies {
compile ('org.springframework.boot:spring-boot-starter-data-jpa:2.0.5.RELEASE') {
exclude group: 'org.apache.logging', module: 'log4j-to-slf4j'
}
....
....
}
Is that right?
Seems you missed "log4j" at the end of group name: "exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' "

Gradle: exclude and include multiple groups/modules in single line from compile closure

this syntax may be not yet provided but I am asking to avoid redundant code.
Right now I am excluding jars like this
compile ('com.mygroup:myJar:0.1.1-M1-SNAPSHOT+') {
exclude group: 'org.apache.xmlgraphics'
exclude group:'org.apache.avalon.framework'
exclude group:'net.engio'
exclude group: 'com.google.guava'
}
How can i exclude multiple groups/modules on a single line of code, for example, this syntax
compile ('com.mygroup:myJar:0.1.1-M1-SNAPSHOT+'){
exclude group: ['org.apache.xmlgraphics', 'org.apache.avalon.framework', 'net.engio', 'com.google.guava']
}
Or is there any other short code which does the same thing.
Thank You.
You could do something like this:
compile ('com.mygroup:myJar:0.1.1-M1-SNAPSHOT+'){
['org.apache.xmlgraphics', 'org.apache.avalon.framework', 'net.engio', 'com.google.guava'].each {
exclude group: it
}
}
Note that this is leveraging a Groovy feature, not a Gradle feature.
Note also that I don't believe that include is a thing in this context (see the method summary here).
compile ('com.mygroup:myJar:0.1.1-M1-SNAPSHOT+'){dep ->
['org.apache.xmlgraphics', 'org.apache.avalon.framework', 'net.engio', 'com.google.guava'].each {group -> dep.exclude group: group }
}
Refer to this.

Gradle multiple compile dependencies syntax

I am trying to declare a compile dependency in Gradle 1.12, with multiple items that shares the same exclude clauses (this is to avoid repeating the exclusion everywhere). I know I can do something like this:
configurations {
compile.exclude group: 'com.google.gwt'
all*.exclude group: 'com.google.guava'
}
but this will affect ALL configurations. What I want is something like this (which does not work in Gradle 1.12 as written below):
compile (
["org.jboss.errai:errai-data-binding:2.4.4.Final"]
,["org.jboss.errai:errai-data-ioc:2.4.4.Final"]
){
exclude group: 'com.google.gwt'
exclude group: 'com.google.guava'
}
so I can gather together all dependencies for which I need exclusion in one place, and still be able to have elsewhere this:
compile 'com.google.guava:guava:17.0'
Update:
Just to clarify, my only goal is to replace this piece of code:
compile ('bla.bla.bla:1.0'){
exclude 'same.component:1.0' //Ugly repeat
}
compile ('boo.boo.boo:1.0'){
exclude 'same.component:1.0' //Ugly repeat
}
compile ('uh.uh.uh:1.0'){
exclude 'same.component:1.0' //Ugly repeat
}
compile ('oh.oh.oh:1.0'){
exclude 'same.component:1.0' //Ugly repeat
}
with something short and sweet like this (not working currently):
compile( 'bla.bla.bla:1.0'
,'boo.boo.boo:1.0'
,'uh.uh.uh:1.0'
,'oh.oh.oh:1.0'
)
{
exclude 'same.component:1.0' //Only once! Sweet!
}
There is no way to have per-dependency excludes while still being able to use the compile 'com.google.guava:guava:17.0' syntax. configurations.compile.exclude ... will only affect the compile configuration (and configurations inheriting from it), and is almost always preferable over per-dependency excludes.
Another solution is to factor out dependency declarations with something like:
ext.libs = [
error_data_ioc: dependencies.create("org.jboss.errai:errai-data-ioc:2.4.4.Final") {
exclude group: 'com.google.gwt'
exclude group: 'com.google.guava'
}
]
Then you can reuse these declarations wherever you need them (e.g. dependencies { compile libs.error_data_io }; also works from a subproject). If you really wanted, you could also share the same { exclude ... } block among multiple declarations (by assigning it to a local variable).

Resources