2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-24 23:17:13 -07:00

Updated for RIFE2 1.1.1.

Added RIFE2 agent and relevant instructions.
Improved README.
This commit is contained in:
Geert Bevin 2023-02-13 08:30:34 -05:00
parent 1c93546fd7
commit 44637cc6fc
3 changed files with 42 additions and 10 deletions

View file

@ -42,6 +42,10 @@ Go to:
The resulting archive will be in:
`war/build/libs`
If you use any of the byte-code instrumented features , like continuations,
metadata merging or lazy-loaded database entities, you'll need to launch your
servlet container with the `-javaagent:[path-to]/rife2-*-agent.jar` argument.
Exactly how is dependent on each servlet container.
## Making an UberJar
@ -54,4 +58,26 @@ Then run it with:
```bash
java -jar app/build/libs/hello-uber-1.0.jar
```
```
If you use any of the byte-code instrumented features, you'll need to also tell
`java` to use the RIFE2 agent.
For example:
```bash
java -javaagent:[path-to]/rife2-*-agent.jar -jar app/build/libs/hello-uber-1.0.jar
```
## Get in touch
Thanks for using RIFE2!
If you have any questions, suggestions, ideas or just want to chat, feel free
to post on the [forums](https://github.com/gbevin/rife2/discussions), to join
me on [Discord](https://discord.gg/DZRYPtkb6J) or to connect with me on
[Mastodon](https://uwyn.net/@gbevin).
**Read more in the [full documentation](https://github.com/gbevin/rife2/wiki)
and [RIFE2 Javadocs](https://gbevin.github.io/rife2/).**

View file

@ -2,8 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
application
java
}
base {
@ -28,7 +27,8 @@ sourceSets.main {
}
dependencies {
implementation("com.uwyn.rife2:rife2:1.1.0")
implementation("com.uwyn.rife2:rife2:1.1.1")
runtimeOnly("com.uwyn.rife2:rife2:1.1.1:agent")
runtimeOnly("org.eclipse.jetty:jetty-server:11.0.13")
runtimeOnly("org.eclipse.jetty:jetty-servlet:11.0.13")
runtimeOnly("org.slf4j:slf4j-simple:2.0.5")
@ -37,11 +37,6 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
}
application {
// Define the main class for the application.
mainClass.set("hello.App")
}
tasks {
named<Test>("test") {
useJUnitPlatform()
@ -72,6 +67,16 @@ tasks {
dependsOn("precompileTemplates")
}
// Replace the run task with one that uses the RIFE2 agent
register<JavaExec>("run") {
classpath = sourceSets["main"].runtimeClasspath
mainClass.set("hello.App")
val rifeAgentJar = configurations.runtimeClasspath.get().files
.filter { it.toString().contains("rife2") }
.filter { it.toString().endsWith("-agent.jar") }[0]
jvmArgs = listOf("-javaagent:$rifeAgentJar")
}
// These two tasks create a self-container UberJar
register<Copy>("copyWebapp") {
from("src/main/")
@ -89,6 +94,7 @@ tasks {
}
val dependencies = configurations
.runtimeClasspath.get()
.exclude("**/rife2*-agent.jar")
.map(::zipTree)
from(dependencies, "$buildDir/webapp")
with(jar.get())

View file

@ -19,5 +19,5 @@ dependencies {
tasks.war {
webAppDirectory.set(file("../app/src/main/webapp"))
webXml = file("src/web.xml")
rootSpec.exclude("**/jetty*.jar", "**/slf4j*.jar")
rootSpec.exclude("**/jetty*.jar", "**/slf4j*.jar", "**/rife2*-agent.jar")
}