I need help. My dependency is following:
compile group: 'org.springframework.cloud', name: 'spring-cloud-stream-binder-kinesis', version: '2.0.1.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '3.0.2.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework:spring-context-support'
I get the error:
java.lang.NoClassDefFoundError: org/springframework/web/context/support/StandardServletEnvironment
Is there something wrong with my dependency?
it's in spring-web, which is a dependency of spring-boot-starter-web. Here you've overridden spring-web with a very old Spring Framework version. That's the source of your problem.
Related
How to avoid redeclaring dependencies in gradle. com.foo.sso.keycloak was built using org.keycloak.keycloak-admin-client and I don't want to redeclare the dependency even if I use packages from keycloak-admin-client. How do I enable this?
MyApplication's build.gradle
implementation group: 'org.keycloak', name: 'keycloak-spring-boot-starter', version: '15.0.0'
implementation group: 'org.keycloak', name: 'keycloak-admin-client', version: '15.0.0'
implementation group: 'com.foo.sso.keycloak', name: 'sso-keycloak-admin', version: '15.0.0'
Use api when defining the dependencies in build.gradle of keycloak-admin-client. This will expose them to the projects that in turn depend on the client.
Ex:
// build.gradle (keycloak-admin-client)
api group: 'org.keycloak', name: 'keycloak-spring-boot-starter', version: '15.0.0'
// build.gradle (com.foo.sso.keycloak)
implementation group: 'org.keycloak', name: 'keycloak-admin-client', version: '15.0.0'
implementation group: 'com.foo.sso.keycloak', name: 'sso-keycloak-admin', version: '15.0.0'
I'm using selenium for UI testing in java.
I have a module cloned from git hub which is being used in my project.
In spite of having the latest jar dependencies in my build.gradle file(intelliJ), I'm encountering
package org.openqa.selenium.html5 not found error
Only during runtime.
The selenium dependency does not complain at compile time, but during run time I am having errors that say
java:package org.openqa.selenium.logging does not exist
java:package org.openqa.selenium.remote does not exist
java:package org.openqa.selenium.support.ui does not exist
java:package org.openqa.selenium does not exist
I try clearing my gradle cache and re-installing the jars with the latest versions, and yet it's still the same issue.
These are the dependencies I have for selenium in my project:
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-api', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '4.0.0-alpha-2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '4.0.0-alpha-2'
I also tried with different versions of selenium, but nothing works.
Any solutions that I could try to fix this issue.
Or am I missing something?
Iam having a MVC portlet created using gradle, I want to parse JSON in it, so I included following packages like below,
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.JSONValue;
Also I have included org.json in build.gradle file as you can see below:
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
//compile group: 'com.squareup.okhttp', name: 'okhttp', version: '2.6.0'
compile group: 'org.json', name: 'json', version: '20180813'
compile group: 'org.apache.clerezza.ext', name: 'org.json.simple', version: '0.4'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5'
}
Compiling was successful but while deploying it in Liferay(7), Iam getting the below error:
While deploying in Liferay am getting this error:
org.osgi.framework.BundleException: Could not resolve module: mvc [952]_ Unreso
lved requirement: Import-Package: org.json; version="[20180813.0.0,20180814.0.0)
Should I include the package org.json inside liferay as well? If yes where should I add it?
I couldn't add any new packages Please anyone help me on this.
When you declare build-time dependencies to libraries that are not made available in Liferay out of the box (be it for the library itself, or for the specific version), the compiler will be happy, and bnd will generate (if required) runtime dependencies into your module's Manifest.mf.
If indeed these dependencies result in runtime dependencies, you'll have to make the libraries available to the OSGi runtime (Liferay in this case) as well. You do that in the same way you're deploying your own modules: Just drop them into Liferay's deploy folder.
In my gradle script I have following dependencies:
dependencies {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'3.9.1'
compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '2.2.4'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
compile group: 'org.uncommons', name: 'reportng', version:'1.1.4'
compile group: 'com.google.inject', name: 'guice', version:'4.0'
compile group: 'org.apache.commons', name:'commons-math3', version: '3.6.1'
testCompile group: 'org.testng', name: 'testng', version:'6.14.3'
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'}
As seen here I ask to use 6.14.3 as the testng version. Only when I try to run my script I get the issue:
Execution failed for task ':compileJava'.
I first checked if the Java version is correct, but no issues there. Only if i run gradle --debug. I found that testng jar downloaded was of version 7.0.0-beta4. But as I did not declare this I'm not sure why this is used or I can force to use the correct one?
Running ./gradlew dependencies should show you the following compile dependencies (amongst many others):
…
+--- org.uncommons:reportng:1.1.4
| +--- org.testng:testng:[5.0,) -> 7.0.0-beta6
| \--- velocity:velocity:1.4
| \--- velocity:velocity-dep:1.4
…
In other words, your declared compile dependency on org.uncommons:reportng:1.1.4 has a transitive dependency on TestNG which Gradle resolves to the latest TestNG version – since you don’t explicitly declare any other TestNG dependency for the compile configuration. Note that you only directly depend on TestNG from the testCompile configuration!
You should be able to fix this by changing your TestNG dependency declaration as follows:
compile group: 'org.testng', name: 'testng', version:'6.14.3'
I am relatively new to using gradle, and am having trouble understanding dependencies. I have been using the Apache POI library to read from excel for a project, and initially I downloaded the JARs into my project and it worked completely fine. I decided to use gradle dependencies when I put my project on GitLab (from what I understand it is the same as using JARs but better when sharing the project since you don't have to download them?). This worked for most of the imports; however, for some reason my project is no longer able to import CellType. I redownloaded the JARs for the time being and it works again.
A summary of the question(s):
Why is CellType the only thing that stopped working, and why did it stop working? What is different about it?
Edit: here is the dependencies section from my build.gradle
compile 'com.google.apis:google-api-services-sheets:v4-rev499-1.23.0'
testCompile group: 'org.testng', name: 'testng', version: '6.9.10'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.8.1'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6
compile group: 'com.google.oauth-client', name: 'google-oauth-client-java6', version: '1.11.0-beta'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.11.0-beta'
// https://mvnrepository.com/artifact/org.apache.poi/poi
compile group: 'org.apache.poi', name: 'poi', version: '3.9'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
(Sorry for the messiness :/ )
The compile error I was getting was something like "cannot resolve" (the import statement was turning red)
import org.apache.poi.ss.usermodel.CellType;