https://kotlinlang.org logo
Title
n

Nykykof

08/02/2018, 7:39 AM
Hello. I'm working on a pure kotlin-based web projetc. It's work fine locally and i want to deploy it on a cloud foundry. But the official Java buildpack does not work for it. Any idea on how i can make this works ? ( I created a channel for it #cloudfoundry)
g

gildor

08/02/2018, 7:48 AM
Do you use Kotlin JVM? Do they support Java? If so what is your problem?
n

Nykykof

08/02/2018, 7:48 AM
1- Yes i use Kotlin JVM, 2- The cloud foundry platform support very well Java ( i deployed another java apps on it). The ussue is that the official buildpack for Java does not work for kotlin. It seems that it support some JMV-languages but i checked and Kotlin seems to not belong to the suppoted JVM-language
g

gildor

08/02/2018, 8:03 AM
But what exactly do you upload? Jar?
n

napperley

08/02/2018, 8:04 AM
Is the buildpack designed to work with a major build system (Gradle, Maven etc)?
1
d

dave

08/02/2018, 8:16 AM
The CF jdk buildpack will work with a standard application distribution zip out of the box
n

Nykykof

08/02/2018, 8:26 AM
I upload a jar
for sure the buildpack works at leaste with Gradle and maven
g

gildor

08/02/2018, 8:29 AM
But there is no difference on jar level between Kotlin and Java
same, it’s transparent if you use Gradle or Maven
n

Nykykof

08/02/2018, 8:32 AM
It's what i told to myself when i pushed the jar file ( no difference between java and Kotlin at jar level). But the cloud foundy throws this error message: ERROR Finalize failed with exception #<RuntimeError: No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
g

gildor

08/02/2018, 8:35 AM
Do you use distZip format?
I still think that there is some problem in your configuration, for example you need some config in META-INF
I mean there is no magic there, just a jar with some classes and probably META-INF to specify entry point
d

dave

08/02/2018, 8:38 AM
@Nykykof the easiest way to do that in gradle is to
apply plugin: 'application'
and then set a
mainClassName = 'fully.qualified.MainKt'
<-- the Kt is important if you're using a floating main function as your entry point
n

Nykykof

08/02/2018, 8:48 AM
@dave i use maven. is there an equivalent ?
d

dave

08/02/2018, 8:49 AM
Definitely, although I can't tell you what it is because I'm not exactly a fan of maven 😉
😥 1
n

Nykykof

08/02/2018, 8:54 AM
@gildor i'm going to explore the way of META-INFO
g

gildor

08/02/2018, 8:58 AM
“way of META-INFO” this is exactly the way what @dave suggested, Gradle plugins does exactly this: configure META for you
something like this, I suppose. Just not really familiar with Maven
n

Nykykof

08/02/2018, 9:01 AM
ok thanks @dave and @gildor. i will check it
f

fitzoh

08/02/2018, 1:38 PM
Might want to try the #java-buildpack channel in the cloud foundry slack
It’s definitely using the java buildpack, right?
n

Nykykof

08/06/2018, 7:51 AM
@fitzoh Yes it's using the java buildpack
My pom.xml was not very well configured so the manifest was also bad generated. I still having some issues (having 502 bad gateway error when consuming the APIs) but my app is now runnig on cloudfoundry thanks to @gildor ans @dave
🎉 1
👍 1