Comments (6)
In reproduce the bug.
This is a kbson bug (see jershell/kbson#25)
Workaround:
In your build.gradle.kts:
@CacheableRule
abstract class TargetJvmVersionRule @Inject constructor(val jvmVersion: Int) : ComponentMetadataRule {
@get:Inject abstract val objects: ObjectFactory
override fun execute(context: ComponentMetadataContext) {
context.details.withVariant("apiElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
}
}
}
}
dependencies {
components {
withModule<TargetJvmVersionRule>("com.github.jershell:kbson") {
params(8)
}
}
...
}
HTH
from kmongo.
I still get an error, but somewhat different?
* What went wrong:
Execution failed for task ':backend:run'.
> Could not resolve all files for configuration ':backend:runtimeClasspath'.
> Could not resolve com.github.jershell:kbson:0.5.0.
Required by:
project :backend > org.litote.kmongo:kmongo-coroutine-serialization:4.9.0 > org.litote.kmongo:kmongo-serialization-mapping:4.9.0
> No matching variant of com.github.jershell:kbson:0.5.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' capability com.github.jershell:kbson:0.5.0 declares a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'runtimeElements' capability com.github.jershell:kbson:0.5.0 declares a runtime of a library, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
@CacheableRule
abstract class TargetJvmVersionRule implements ComponentMetadataRule {
@Inject abstract ObjectFactory getObjects()
final Integer jvmVersion
@Inject TargetJvmVersionRule(Integer jvmVersion) {
this.jvmVersion = jvmVersion
}
void execute(ComponentMetadataContext context) {
context.details.withVariant("apiElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_API))
}
}
}
}
dependencies {
components {
withModule("com.github.jershell:kbson", TargetJvmVersionRule) {
params(8)
}
}
from kmongo.
I tried issuing bot apiElements and runtimeElements, still no luck
* What went wrong:
Execution failed for task ':backend:compileKotlin'.
> Could not resolve all files for configuration ':backend:compileClasspath'.
> Could not resolve com.github.jershell:kbson:0.5.0.
Required by:
project :backend > org.litote.kmongo:kmongo-coroutine-serialization:4.9.0 > org.litote.kmongo:kmongo-serialization-mapping:4.9.0
> The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. However we cannot choose between the following variants of com.github.jershell:kbson:0.5.0:
- apiElements
- runtimeElements
All of them match the consumer attributes:
- Variant 'apiElements' capability com.github.jershell:kbson:0.5.0 declares an API of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attribute:
- Provides release status but the consumer didn't ask for it
- Variant 'runtimeElements' capability com.github.jershell:kbson:0.5.0 declares an API of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attribute:
- Provides release status but the consumer didn't ask for it
code:
@CacheableRule
abstract class TargetJvmVersionRule implements ComponentMetadataRule
{
@Inject
abstract ObjectFactory getObjects()
final int jvmVersion
@Inject
TargetJvmVersionRule(int jvmVersion)
{
this.jvmVersion = jvmVersion
}
void execute(ComponentMetadataContext context)
{
context.details.withVariant("apiElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_API))
}
}
context.details.withVariant("runtimeElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_API))
}
}
}
}
dependencies {
components {
withModule("com.github.jershell:kbson", TargetJvmVersionRule) {
params(8)
}
}
from kmongo.
Looks like it's complaining about an attribute it didn't ask for so I removed it and it went through, code:
@CacheableRule
abstract class TargetJvmVersionRule implements ComponentMetadataRule
{
@Inject
abstract ObjectFactory getObjects()
final int jvmVersion
@Inject
TargetJvmVersionRule(int jvmVersion)
{
this.jvmVersion = jvmVersion
}
void execute(ComponentMetadataContext context)
{
context.details.withVariant("apiElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
}
}
context.details.withVariant("runtimeElements") {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion)
}
}
}
}
from kmongo.
What is your gradle version ? Tested on my side with gradle 8.1.1
from kmongo.
This fixed my issue. Running with gradle 8.2.1
Looks like it's complaining about an attribute it didn't ask for so I removed it and it went through, code:
@CacheableRule abstract class TargetJvmVersionRule implements ComponentMetadataRule { @Inject abstract ObjectFactory getObjects() final int jvmVersion @Inject TargetJvmVersionRule(int jvmVersion) { this.jvmVersion = jvmVersion } void execute(ComponentMetadataContext context) { context.details.withVariant("apiElements") { attributes { attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion) } } context.details.withVariant("runtimeElements") { attributes { attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jvmVersion) } } } }
from kmongo.
Related Issues (20)
- update error when use nested properties and `setTo`
- ERROR: Invalid build configuration. Attempt to create a global synthetic for 'Record desugaring' without a global-synthetics consumer. HOT 4
- ERROR: 'WrappedObjectId' is not registered for polymorphic serialization in the scope of 'Id' HOT 1
- Consider adding a classpath argument to the ServiceLoader.load call in ClassMappingType.kt
- Can CoroutineCollection<T>.replaceOne(replacement, options) be made non reified?
- Wrong regular expression generated HOT 1
- Use mongodb kotlin bson implementation HOT 1
- kotlinx - UUID Serializer - String HOT 4
- Support for CSFLE and Queryability Encryption HOT 1
- Feature Request - MongoDB Compass Pipeline shell to kotlin kmongo support
- @Transient from kotlin serialization does not deserialize data? HOT 1
- When using SerialName, the Bson document generated by kmongo is incorrect HOT 2
- Request: Add explicit error message when incorrectly registering codecs to prevent OutOfMemoryError
- Kotlinx Serialization? HOT 4
- Add support to pass options to aggregate query (hint and allowDiskUse)
- How to aggregate objects by regex on list HOT 1
- STOP debug org.mongodb.driver logs HOT 1
- Expose default Jackson codec HOT 1
- Appreciation post HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kmongo.