Kotlin complains about API version not supported - maven

I'm relatively new to Kotlin.
I did create a test project, just the Hello World for now.
Compile/Package OK, then when I try to run the main.kt :
Kotlin: API version 1.1 is no longer supported; please, use version 1.2 or greater.
Is driving me nuts.
Ok, here some info and things I did :
Ubuntu 18.04
IntelliJ Idea Ultimate 2020.3 - all plugins/libraries updated
Kotlin project created from Project --> Kotlin --> Console Application --> SDK 1.8 --> Maven (need to simulate another environment that has similar settings)
On Settings/Build/Kotlin Compiler I selected Language version 1.4
When building I have only some warnings and I did notice this one :
[WARNING] Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/home/steve/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.1.1/kotlin-stdlib-1.1.1.jar (version 1.1)
/home/steve/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.31/kotlin-stdlib-jdk8-1.4.31.jar (version 1.4)
/home/steve/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.4.31/kotlin-stdlib-jdk7-1.4.31.jar (version 1.4)
So it seems is still importing a stdlib 1.1.1, I did try to remove manually it but without success, is always there.
The POM only has this from jetbrains :
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.4.31</version>
</dependency>
Can anybody please give me some suggestions about how to fix this kind of problem ?
Thanks
STeve
Ok, I did restart from scratch many times trying to identify the problem and I think I did it, i.e. I identified the problem but I don't have a solution.
Starting from scratch everything is working, however I need to add to the project some classes I created in other projects in order to test them.
One of the class imported uses a library called khttp.
Well the moment I add this library as dependence in the project, even without adding any code that use it, screw up everything and I end up with the error :
Kotlin: API version 1.0 is no longer supported; please, use version 1.3 or greater.
The ONLY way I found so far to solve the problem is to remove from the POM the dependency of the library.
So I guess that the problem is IN the library.
If I can't find a solution I guess I need to don't use khttp.
Thanks

Go to
Intellij Preferences -> Build, Execution, Deployment -> Compiler -> Kotlin Compiler. Update Language version
and Api version to the one you wish.
**Click run again it should work fine.

for me it worked like this: right click on project and go to
project settings -> modules -> Kotlin
there I set the API Version to 1.5

I update the Kotlin dependencies version in pom.xml from 1.3.61 to 1.5.10 and it's ok for me

Project Structure>Modules>General
When you go there you gonna see 2 sections right side. Language version and API version. Update these 1.5 and problem will solve easily.

Related

gradlew: What wrong can happen if gradle versions is not consistent

I am new to gradle. But I do understand to some extent why developers are encouraged to use gradlew instead of gradle. However what worse could happen if developers use different versions of gradle to build their project? At the end of the day any gradle version makes sure that dependencies of the project is managed properly. For example if a Spring Boot project is dependent of a starter plugin version 2.x, no matter what version of gradle is used, the build tool makes sure that 2.x is available
As far as I'm aware the main point to use a common version of Gradle is plugin compatibility.
Gradle's internal APIs changed quite a lot in the last few versions, so not every plugin works with every Gradle version.
For example: Spring Boot's 2.3.4 reference explicitly states that it's build plugin requires Gradle 6.3 or later (although 5.6 is mentioned to work in a deprecated form)
https://docs.spring.io/spring-boot/docs/2.3.x/reference/htmlsingle/#getting-started-system-requirements
So while you can be sure that the Spring Boot version is used (because you defined it in your buildfile) any older version of Gradle is likely to run into Exceptions when trying to build your project.
Even if you're just using plugins that are provided by Gradle itself there can be compatibility issues. For example the java configuration block was first introduced in Gradle 5 (I think) and therefore would cause a syntax error in earlier versions.
Or simple things like Java versions that older version of Gradle do not support.
The more plugins you use it becomes increasingly unlikely that a lot of Gradle versions will be able to run it. Using the Gradle Wrapper is therefore a simple way that your build works for everyone.
And from the other perspecitve: if you are the one that usually maintains the build you can use all the latest Gradle features using the Wrapper as you can be sure it will not break anything. Getting everyone on the team to update manually before you can use a feature can be a pain
That beeing said, it's really primarly a maintenance issue. Nothing bad can happen if anyone uses their own installed version of gradle, except it might just not work
If everyone on the team uses a similar version nothing might happen at all

Which versions are required to get a working Acceleo Maven build

Has anyone got the Acceleo Maven build to work?
If so what combination of Maven, Tycho, Eclipse, Acceleo, UML2/ecore worked for you?
And as a supplementary question do you still need to adjust the Java classes and config files before running the build (as was required for the old ANT build)?
To be clearer tycho does not like Maven 3.3, Maven 3.3 is the default with Luna. Every version of Eclipse has a different version of the ecore/uml model built in so migrating the Acceleo templates to another version of eclipse requires changes in all "module" definitions and hacking the version inside the UML models, so, its tedious trying to work out which versions are compatible.
I just wondered if someone had a working setup where all the components worked together.
After much trial and error:-
Eclipse Luna
Comes with Eclipse m2e 1.5
ecore uml2 version 5.0.2
Acceleo 3.5.1
Maven 3.0.5
org.eclipse.acceleo:org.eclipse.acceleo.maven:3.5.0-SNAPSHOT
All work together without the usual class not found and missing jars.
However I have yet to build a working pom that actually generates some
template output.
Interestingly the ANT build seems to work fine.
In the end it was just easier to knock up a .bat script to run
the generate and build.
You can have a look at the UML to Java generator of the Eclipse Foundation for the configuration of the pom.xml. For additional information on the use of maven with Acceleo, look at the dedicated page on the wiki.
You do not need to modify any Java class or configuration file now.

Get dependency source code with gradle

Is there a way to get the sourcecode of a dependency using gradle.
I've found that using the eclipse or the idea plugin may work but I want to keep my code IDE agnostic. Is there a way to obtain the source code for a given dependency? and/or using the eclipse or idea plugin would require me to have those IDE's installed to work?
I noticed this was solved since Gradle 2.0, the source in my case is in:
~/.gradle/caches/modules-2/files-2.1/

How should I set up a Maven/Groovy project in STS?

I have a project that uses some Java and some Groovy, and it's all built with Maven. We use the GMaven plugin to compile the Groovy. I've been using Eclipse and have got fed up with the "Plugin execution not covered by lifecycle" message that indicates Eclipse is incapable of doing what my command-line does (I've tried adding the ignore/execute config to fix it, but it never works properly), so I've switched to Spring Tool Suite, which claims to have full Groovy support. How should I set it all up? So far I've had exactly the same experience as with regular Eclipse, but given that SpringSource are responsible for Groovy, I figure there must be a way of doing it.
Have you read this thread?
http://forum.springsource.org/showthread.php?130130-Working-with-Mavenized-Grails-projects-in-GGTS-3-1-0-Updated-for-3-1-0-release/page2
For grails projects, you do not need to use gmaven or the groovy-eclipse-compiler. You must be using the 3.1.0 STS (which is not actually released yet, but you can get this
You also must be using Grails 2.1.1.
You can secretly get a 3.1.0 release build by going to this download page:
http://www.springsource.org/downloads/sts-ggts
Instead of clicking on the links, copy them and substitute 3.1.0 for 3.0.0.

No AspectJ getter/setter -- upgrade Roo from 1.1.5 to 1.2.1

I am upgrading current project from Roo 1.1.5 to 1.2.1.
I have noticed there are some new features in Roo 1.2.1 to facilitate JPA functionality, i.e. #RooEntity to #RooJpaActiveRecord, but I thought when I open Roo shell in STS it could handler that conversion automatically...I can still achieve that manually, however, after I change the annotation name, no matter I use poll now or re-build the project, all the getter/setter/finder/entityManager are error out due to no AspectJ injection, actually I can see the aspectJ files are generated, STS just cannot identify them with the entity java file. So suddenly the whole project falls apart.
Please, geniuses on the stack, let me know how to fix that. Many thanks in advance.
I have figured out the solution:
Simply speaking: make sure running the project as a Maven project.
How: Right click project->Configure->Convert to Maven Project. Then run Right click project -> Maven -> Update Project Configuration.
Maven will build the project once again with aspect injection. I think the problem is previously my project is compiled under Spring Tools -> Update Maven Dependencies where if the STS/AspectJ Tool stop working, then the project will suffer from missing aspect injection(still thinking it is could be a remaining bug of STS, this issue may be very specific but still STS fail the job).
Sorry I have to answer my own question
Make sure you clean your project eclipse style. That is run Project->Clean.

Resources