The jar amazon-kinesis-connectors is using amazon-kinesis-client. I want to change this dependency to a local custom jar:
dependencies {
compile ('com.amazonaws:amazon-kinesis-connectors:1.2.0'){
exclude group: "com.amazonaws", module: "amazon-kinesis-client"
}
compile files('libs/amazon-kinesis-client-1.6.3.jar')
//...
}
It compiles ok, but when I'm running the code I get java.lang.NoClassDefFoundError: com/amazonaws/services/kinesis/clientlibrary/interfaces/IRecordProcessorFactory. Is there a way to do this dependency management in gradle?
As environment I'm using:
gradle 2.13
intellij idea CE 2006.1
java 1.8
Edit:
dependency graph in intellij:
Running using a gradle task:
task run_app(type:JavaExec) {
main = 'org.main.RunApp'
classpath = sourceSets.main.runtimeClasspath
}
try below gradle configuration
dependencies {
compile ('com.amazonaws:amazon-kinesis-connectors:1.2.0'){
exclude group: "com.amazonaws", module: "amazon-kinesis-client"
}
compile files('libs/amazon-kinesis-client-1.6.3.jar')
runtime files('libs/amazon-kinesis-client-1.6.3.jar')
//...
}
or you can use application plugin to create executable jar
https://docs.gradle.org/current/userguide/userguide_single.html#application_plugin
Related
I'm trying to run spring boot project, but i get this error.
any idea what error is this ?
Cannot find JAR 'aws-java-sdk-core-1.11.948.jar' required by module 'gradle-resources-s3' using classpath or distribution directory '/home/mbunderline76/.gradle/wrapper/dists/gradle-7.3.2-bin/4k4cn06q0rruwh9dpndf9gmi8/gradle-7.3.2'
You need to add dependency for the jar required by your gradle version. Trying adding this dependency and refreshing your gradle.
implementation group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.948'
or
implementation 'com.amazonaws:aws-java-sdk-core:1.11.948'
Running on M1 Mac with Kotlin, Adding
configurations.all {
resolutionStrategy {
force ("software.amazon.awssdk.crt:aws-crt:0.16.12")
}
}
to the build.gradle.kts file (don't forget to refresh) worked for me as a work around per this(https://github.com/awslabs/aws-sdk-kotlin/issues/473) github issue
I'm restructuring/refactoring build process for a big(ish) project. Currently it contains over a dozen separate modules built with standalone build scripts each. I want to integrate them all into a single multiproject build in Gradle.
After I integrated all sources into a single tree, fixed build.gradles, I came upon the following problem. Dependencies for many modules contain something like:
dependencies {
compile group: 'com.company', name: 'Module', version: '1.2.3'
// ...
testCompile group: 'com.company', name: 'Module', version: '1.2.3', classifier: 'tests'
}
I want the build to use jars from the subproject, not from a repository. I replaced compile ... with compile project(':Module') and it works fine. However, I cannot find the way to pass 'tests' specifier to the testCompile project... dependency.
Is there a way to pick up the tests jar as a dependency to testCompile?
In the producing project you will need to declare the "Test" JAR as outgoing artifact.
configurations {
testUtils
}
task testUtilsJar(type: Jar) {
...
}
artifacts {
testUtils testUtilsJar
}
In the consuming project you depend on it as such:
dependencies {
testCompile project(path: ':Module', configuration: 'testUtils')
}
Normally in android I can just edit the build.gradle file and place my compile dependencies like this:
dependencies {
compile 'com.android.support:support-v4:23.+'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
}
How can I add a compile dependency in a codenameone project?
The generated project utilizes the jcenter() repository.
In order to add a compile dependency you will need to use the 'gradleDependencies' build hint, for example:
gradleDependencies=" compile 'com.facebook.android:facebook-android-sdk:4.7.0'\n"
Say I have a project ProjectA with a compile dependency on core. And core depends on deepcore. Thus, ProjectA has a transitive dependency on deepcore.
So, build script for ProjectA has this
dependencies {
compile "com.something:core:1.0.0"
}
And build script for core has this
dependencies {
compile "com.something:deep-core:1.0.0"
}
Now, there is a class CoreService defined in both core and deepcore with the same package structure. And I am using that class from my ProjectA, which implementation will it use? How do configure my dependency so that I am using the version from core?
This should do what you are looking for.
dependencies {
compile "com.something:deep-core:1.0.0" {
exclude group: 'com.unwanted', module: 'unwanted'
}
}
I need to exclude a jar from runtime dependency via Gradle.
I am getting this error:
Caused by: java.lang.IllegalStateException: Conflicting persistence unit definitions for name 'ldb-jpa': file:/D:/EricFrancis/shared/build/libs/shared.jar, file:/D:/EricFrancis/shared/build/resources/main
I'm trying to exclude the jar.
How do I tell gradle to do this?
Without more information (Gradle version, relevant parts of build script, etc.), it's hard to say. But since this isn't a Maven or Ivy dependency, I'd consider not adding it in the first place.
It turns out that I did not understand how configurations worked.
I was able to exclude the jar via:
configurations {
testRuntime {
exclude module: 'share'
}
testCompile {
exclude module: 'share'
}
}