How to reference mavenLocal build of korge-next for my Korge project? - korge

How would I setup the gradle configuration stuff so it references the stuff in the .m2 folder?
I tried referencing the version like so:
A problem occurred configuring root project 'KorgeClient'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:2.0.0.999.
Required by:
project :
> No matching variant of com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:2.0.0.999 was found. The consumer was configured to find a runtime of a library compatible with Java 16, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.3.3' but:
- Variant 'apiElements' capability com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:2.0.0.999 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 16
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.3.3')
- Variant 'runtimeElements' capability com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:2.0.0.999 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 16
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.3.3')
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'KorgeClient'.
...

The problem was because I was building korge-next using java 17 rather than java 16.
After switching to building with java 16, I am able to reference the mavenLocal version.
Here's the setting that I needed to change:

Related

IntelliJ Gradle build failure: Incompatible because component compatible with Java 17 and the consumer needed Java 11

In IntelliJ, when I do a clean build on a new project downloaded from start.spring.io, it gives an error.
Spring Configuration on start.spring.io
I have already installed Java 17 JDK (Amazon Corretto) downloaded directly from IntelliJ
In terminal, ran command: ./gradlew clean build
resulted in the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'learn-spring-framework'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.1.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.1
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.1 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Thanks in advance for the help
Tried:
Make sure the Project is using Java 17 SDK under File -> Project Structure
Make sure the Gradle JVM is pointing to Java 17 SDK under IntelliJ IDEA -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Tried to change build.gradle file for
sourceCompatibility = (11 or 17)
targetCompatibility = (11 or 17)
java {
toolchain {
languageVersion = JavaLanguageVersion.of( (11 or 17) )
}
}
Weirdly, the project just builds fine if I just click on the "play" button on IntelliJ
Spring Boot 3 requires as minimum version JDK 17.
If you want to configure InteliJ with gradle using JDK 17 or later the following configurations are needed.
File -> Project Structure -> Project -> Project SDK -> specify a jdk of 17 or later
You also need the following configuration. File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM and specify a jdk of 17 or later.
Keep in mind that the above configurations apply to the embedded version of gradle which InteliJ uses as an embedded tool. Not the one configured to run from Terminal
In order to use the embedded tool version for gradle terminal which will already be set up with Jdk 17 according to the above configurations, you need to run commands as shown bellow:
This should be enough to execute your project.
Otherwise If you insist on using the terminal to execute gradle commands, then you need to make all the necessary adaptations in environmental variables. To do so head into File -> Settings -> Tools -> Terminal -> Enviroment Variables . For environmental changes to take effect you have to restart InteliJ window. After restart you can confirm with gradle -version command if the correct JVM and gradle version is set up or not. Also you can use the java -version to see in what JDK the terminal points to. Spring Boot Initializer delivers also a portable gradle file which is compatible to run the project. So if you have under environmental properties another gradle installed in your system you can detect with above commands and remove so that you can use only the local one which is shipped.

Maven (Tycho) cannot resolve OSGi Core bundle

I have a dependency on "org.osgi:osgi.core" (7.0.0) in my POM. The reason is that I need access to the "org.osgi.framework" package. I am using Maven (3.6) and Tycho (1.5.1) for building. The build platform runs Debian 10 and Java 11.
I get the following error:
Missing requirement: osgi.core 7.0.0.201802012106 requires 'osgi.unresolvable; (&(!(must.not.resolve=*))(must.not.resolve=*))' but it could not be found
However, if I remove the dependency I get the following error:
Missing requirement: my.bundle 0.0.0.qualifier requires 'java.package; org.osgi.framework 1.7.0' but it could not be found
What is going wrong? How can I resolve this problem?
I get the following error:
Missing requirement: osgi.core 7.0.0.201802012106 requires 'osgi.unresolvable; (&(!(must.not.resolve=*))(must.not.resolve=*))' but it could not be found
The "companion jars" are not meant for runtime and since resolving is a runtime operation (even when performed during build, i.e. for deployment purposes) should not be included (and are therefore marked with the unresolvable requirement).
However, if I remove the dependency I get the following error:
Missing requirement: my.bundle 0.0.0.qualifier requires 'java.package; org.osgi.framework 1.7.0' but it could not be found
This means you have no runtime framework available! Add a runtime dependency on the equinox framework (not intentionally being biased, but since you're using tycho I'm assuming eclipse/equinox landscape. If you have Apache Felix framework available to p2/tycho then use that if you like):
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.x.0</version>
<scope>runtime</scope>
</dependency>
// of course use tycho mechanism for above.

Java 11 with gradle: must specify an absolute path but is ${tools.jar}

We are moving from Java 8 to 11 on a project using jaxb. As it has been removed from the JDK, it has to be included separately, which I have done via gradle config:
compile("javax.xml.bind:jaxb-api:2.2.11")
compile("com.sun.xml.bind:jaxb-core:2.2.11")
compile("com.sun.xml.bind:jaxb-impl:2.2.11")
I am able to run the project, however compileJava gradle job throws errors:
Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-core\2.2.11\db0f76866c6b1e50084e03ee8cf9ce6b19becdb3\jaxb-core-2.2.11.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-core:2.2.11
Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-impl\2.2.11\2d4b554997fd01d1a2233b1529b22fc9ecc0cf5c\jaxb-impl-2.2.11.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-impl:2.2.11
The job finishes and there is a jar created, however when run on production server it stops with this error:
java.lang.NoClassDefFoundError: javax/xml/bind/Unmarshaller$Listener
I'm using Spring Boot v1.5.6 and gradle 4.8.1
The solution is to use a newer version of the jaxb libraries. 2.3.0 is no longer using tools.jar.

Getting unresolved reference error in Kotlin Android Library Project

I am getting unresolved reference error in Kotlin Android Library project.
1.) standard_kotlin_lib.jar --> contains: Kotlin classes, META-INF/standard_kotlin_lib.kotlin_module
2.) A.aar --> compiles only standard_kotlin_lib.jar file. After compilation, inside generated A.aar file’s classes.jar: META-INF/standard_kotlib_lib.kotlin_module is missing, infect whole META-INF is missing
3.) B.aar --> compiles A.aar. Here, kotlin source code importing classes define in “standard_kotlin_lib.jar”. Getting unresolved reference error at import
B.aar <-- A.aar <-- standard_kotlin_lib.jar
Tools Version:
1.) I am using android gradle plugin 3.0.0 and gradle version 4.3.0. With previous plugin version i.e. 2.2.3 and gradle version 3.2.1, this error was not coming. Kotlin version is 1.1.4
Issue I think:
1.) META-INF is missing inside A.aar file. When I manually copy the META-INF inside A.aar’s classes.jar, B.aar compiled successfully.

Camel Compatibility issues

I am using the following camel packages in my Maven project:
camel-core
camel-jms
camel-jaxb
camel-quartz
camel-bindy
camel-ftp
And when all these are using version 2.8.0 my server starts up fine and the app works ok. But if I update the camel version to anything higher like 2.10.0 then I get the following exception on startup and not sure which of these is causing this issue:
Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load type converters because of: Cannot find any type converter classes from the following packages: [org.apache.camel.component.file.remote]
Any help would be much appreciated?
Maybe another library of your project is using a different version of camel.
You can check the camel dependency tree of your project with this maven command:
mvn dependency:tree -Dverbose -Dincludes=camel-core
In verbose mode, the dependency tree shows dependencies that were omitted for being a duplicate of another, conflicting with another's version and/or scope, and introducing a cycle into the dependency tree.
Here are some reference links:
https://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html
https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

Resources