-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9075b0a
commit 148d364
Showing
31 changed files
with
560 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
val javaVersion: String by project | ||
|
||
plugins { | ||
id("com.github.johnrengelman.shadow") | ||
id("io.micronaut.application") | ||
id("io.micronaut.aot") | ||
} | ||
|
||
version = "0.0.1-SNAPSHOT" | ||
group = "com.example" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
annotationProcessor("io.micronaut.serde:micronaut-serde-processor") | ||
implementation("io.micronaut.serde:micronaut-serde-jackson") | ||
runtimeOnly("ch.qos.logback:logback-classic") | ||
testImplementation("io.micronaut:micronaut-http-client") | ||
implementation(project(":micronaut:g-m-lib")) | ||
} | ||
|
||
|
||
application { | ||
mainClass.set("com.example.gmapp.Application") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.toVersion(javaVersion) | ||
targetCompatibility = JavaVersion.toVersion(javaVersion) | ||
} | ||
|
||
graalvmNative.toolchainDetection.set(false) | ||
|
||
micronaut { | ||
runtime("netty") | ||
testRuntime("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("com.example.gmapp.*") | ||
} | ||
aot { | ||
// Please review carefully the optimizations enabled below | ||
// Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
optimizeServiceLoading.set(false) | ||
convertYamlToJava.set(false) | ||
precomputeOperations.set(true) | ||
cacheEnvironment.set(true) | ||
optimizeClassLoading.set(true) | ||
deduceEnvironment.set(true) | ||
optimizeNetty.set(true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "g-m-app", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "./nx-gradle/micronaut/g-m-app/src", | ||
"targets": { | ||
"build": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"outputs": ["{projectRoot}/build"], | ||
"options": { | ||
"task": "build" | ||
} | ||
}, | ||
"build-image": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "dockerBuild" | ||
} | ||
}, | ||
"serve": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "run", | ||
"keepItRunning": true | ||
} | ||
}, | ||
"test": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "test" | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
10 changes: 10 additions & 0 deletions
10
nx-gradle/micronaut/g-m-app/src/main/java/com/example/gmapp/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.example.gmapp; | ||
|
||
import io.micronaut.runtime.Micronaut; | ||
|
||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
Micronaut.run(Application.class, args); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
nx-gradle/micronaut/g-m-app/src/main/java/com/example/gmapp/HelloController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example.gmapp; | ||
|
||
import com.example.gmlib.HelloService; | ||
import io.micronaut.http.MediaType; | ||
import io.micronaut.http.annotation.Controller; | ||
import io.micronaut.http.annotation.Get; | ||
import io.micronaut.http.annotation.Produces; | ||
import jakarta.inject.Inject; | ||
|
||
@Controller("/hello") | ||
public class HelloController { | ||
|
||
@Inject | ||
private HelloService helloService; | ||
|
||
@Get | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String index() { | ||
return helloService.greeting(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
nx-gradle/micronaut/g-m-app/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
micronaut.application.name=GMApp | ||
netty.default.allocator.max-order=3 |
15 changes: 15 additions & 0 deletions
15
nx-gradle/micronaut/g-m-app/src/main/resources/logback.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern> | ||
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n | ||
</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="info"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
19 changes: 19 additions & 0 deletions
19
nx-gradle/micronaut/g-m-app/src/test/java/com/example/gmapp/GMAppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.gmapp; | ||
|
||
import io.micronaut.runtime.EmbeddedApplication; | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@MicronautTest | ||
class GMAppTest { | ||
|
||
@Inject | ||
EmbeddedApplication<?> application; | ||
|
||
@Test | ||
void testItWorks() { | ||
Assertions.assertTrue(application.isRunning()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
nx-gradle/micronaut/g-m-app/src/test/java/com/example/gmapp/HelloControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.gmapp; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import io.micronaut.http.HttpRequest; | ||
import io.micronaut.http.client.HttpClient; | ||
import io.micronaut.http.client.annotation.Client; | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@MicronautTest | ||
public class HelloControllerTest { | ||
|
||
@Inject | ||
@Client("/") | ||
HttpClient client; | ||
|
||
@Test | ||
public void testHello() { | ||
HttpRequest<String> request = HttpRequest.GET("/hello"); | ||
String body = client.toBlocking().retrieve(request); | ||
|
||
assertNotNull(body); | ||
assertEquals("Hello World", body); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
nx-gradle/micronaut/g-m-app/src/test/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
micronaut.server.port=-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
val javaVersion: String by project | ||
val kotlinVersion: String by project | ||
|
||
plugins { | ||
id("org.jetbrains.kotlin.jvm") | ||
id("org.jetbrains.kotlin.plugin.allopen") | ||
id("com.google.devtools.ksp") | ||
id("com.github.johnrengelman.shadow") | ||
id("io.micronaut.application") | ||
id("io.micronaut.aot") | ||
} | ||
|
||
version = "0.0.1-SNAPSHOT" | ||
group = "com.example" | ||
|
||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
ksp("io.micronaut.serde:micronaut-serde-processor") | ||
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime") | ||
implementation("io.micronaut.serde:micronaut-serde-jackson") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}") | ||
runtimeOnly("ch.qos.logback:logback-classic") | ||
runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
testImplementation("io.micronaut:micronaut-http-client") | ||
runtimeOnly("org.yaml:snakeyaml") | ||
implementation(project(":micronaut:g-m-kt-lib")) | ||
} | ||
|
||
application { | ||
mainClass.set("com.example.gmktapp.ApplicationKt") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.toVersion(javaVersion) | ||
} | ||
|
||
graalvmNative.toolchainDetection.set(false) | ||
|
||
micronaut { | ||
runtime("netty") | ||
testRuntime("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("com.example.gmktapp.*") | ||
} | ||
aot { | ||
// Please review carefully the optimizations enabled below | ||
// Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
optimizeServiceLoading.set(false) | ||
convertYamlToJava.set(false) | ||
precomputeOperations.set(true) | ||
cacheEnvironment.set(true) | ||
optimizeClassLoading.set(true) | ||
deduceEnvironment.set(true) | ||
optimizeNetty.set(true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "g-m-kt-app", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "./nx-gradle/micronaut/g-m-kt-app/src", | ||
"targets": { | ||
"build": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"outputs": ["{projectRoot}/build"], | ||
"options": { | ||
"task": "build" | ||
} | ||
}, | ||
"build-image": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "dockerBuild" | ||
} | ||
}, | ||
"serve": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "run", | ||
"keepItRunning": true | ||
} | ||
}, | ||
"test": { | ||
"executor": "@jnxplus/nx-gradle:run-task", | ||
"options": { | ||
"task": "test" | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
7 changes: 7 additions & 0 deletions
7
nx-gradle/micronaut/g-m-kt-app/src/main/kotlin/com/example/gmktapp/Application.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.gmktapp | ||
|
||
import io.micronaut.runtime.Micronaut.run | ||
fun main(args: Array<String>) { | ||
run(*args) | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
nx-gradle/micronaut/g-m-kt-app/src/main/kotlin/com/example/gmktapp/HelloController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.example.gmktapp | ||
|
||
import com.example.gmktlib.HelloService | ||
import io.micronaut.http.MediaType | ||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Get | ||
import io.micronaut.http.annotation.Produces | ||
import jakarta.inject.Inject | ||
|
||
@Controller("/hello") | ||
class HelloController( | ||
@Inject val helloService: HelloService, | ||
) { | ||
@Get | ||
@Produces(MediaType.TEXT_PLAIN) | ||
fun index() = helloService.greeting() | ||
} |
7 changes: 7 additions & 0 deletions
7
nx-gradle/micronaut/g-m-kt-app/src/main/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
micronaut: | ||
application: | ||
name: GMKtApp | ||
netty: | ||
default: | ||
allocator: | ||
max-order: 3 |
15 changes: 15 additions & 0 deletions
15
nx-gradle/micronaut/g-m-kt-app/src/main/resources/logback.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern> | ||
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n | ||
</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="info"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
20 changes: 20 additions & 0 deletions
20
nx-gradle/micronaut/g-m-kt-app/src/test/kotlin/com/example/gmktapp/GMKtAppTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.example.gmktapp | ||
|
||
import io.micronaut.runtime.EmbeddedApplication | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
import jakarta.inject.Inject | ||
|
||
@MicronautTest | ||
class GMKtAppTest { | ||
|
||
@Inject | ||
lateinit var application: EmbeddedApplication<*> | ||
|
||
@Test | ||
fun testItWorks() { | ||
Assertions.assertTrue(application.isRunning) | ||
} | ||
|
||
} |
Oops, something went wrong.