cancel
Showing results for 
Search instead for 
Did you mean: 

I want to deploy a Kotlin application to the BTP Cloud Foundry environment.

yuichi_suganuma
Newcomer
0 Kudos
141

Dear all. First of all, I would like to say to you.

I have an application that is being built with Kotlin on the server side and I am trying to verify if it can run on BTP Cloud Foundry.

Currently I am able to deploy it but the status is error.

I expect it is probably the contents of manifest.yml.
I will give the following details.

I am a beginner and my goal is to display Hello World.

----

# Issue


Do the following

 

 push -f manifest.yml -b sap_java_buildpack

 

yuichi_suganuma_0-1730555417598.png

Check log for details

yuichi_suganuma_1-1730555630997.png

 

2024-11-02T20:15:32.05+0900 [APP/PROC/WEB/0] ERR bash: line 1: java: command not found

 


# Environmen

java 17.0.12

manifest.yml

 

---
applications:
- name: demo
  no-route: true
  buildpacks:
  - sap_java_buildpack
  path: build/libs/demo-0.0.1-SNAPSHOT.jar

 

 

 

build.gradle

 

plugins {
	id 'org.jetbrains.kotlin.jvm' version '1.9.25'
	id 'org.jetbrains.kotlin.plugin.spring' version '1.9.25'
	id 'org.springframework.boot' version '3.3.5'
	id 'io.spring.dependency-management' version '1.1.6'
	id 'application'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
	implementation 'org.jetbrains.kotlin:kotlin-reflect'
	implementation 'org.jetbrains.kotlin:kotlin-stdlib'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

kotlin {
	compilerOptions {
		freeCompilerArgs.addAll '-Xjsr305=strict'
	}
}

tasks.withType(Jar).all {
    duplicatesStrategy 'exclude'
}

jar {
    enabled = true
    archiveClassifier = ''
}

jar {
    from {
        configurations.compileClasspath.collect { // .jarファイルに含める
            it.isDirectory() ? it : zipTree(it)
        }
    }
}

jar {
    manifest {
        attributes 'Main-Class': 'com.example.demo.DemoApplicationKt'
    }
}

 

 

DemoApplication.kt

 

package com.example.demo

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

fun main(args:Array<String>){
    println("Hello Kotlin")
}

 

Accepted Solutions (0)

Answers (0)