-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
Related to an existing integration?
Yes
Existing integration
Java
Overview
AddJavaApp does not currently support passing JVM arguments to executable Java apps.
Usage example
var builder = DistributedApplication.CreateBuilder(args);
builder.AddJavaApp("app", workingDirectory: "./app",
new JavaAppExecutableResourceOptions
{
ApplicationName = "app.jar",
OtelAgentPath = "./agents",
JvmArgs = ["-Darg=value"]
})The only new part here is the additional JvmArgs property.
Breaking change?
No
Alternatives
The only workaround I can think of at the moment is to build a container image for my application which sets the JVM arguments. For example:
# Dockerfile
ENV JAVA_OPTS=""
ENTRYPOINT [ "java", "$JAVA_OPTS", "-jar", "app.jar"]// AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
builder.AddJavaApp(
"containerapp",
new JavaAppContainerResourceOptions
{
ContainerImageName = "registry/app:latest",
OtelAgentPath = "./agents"
})
.WithEnvironment("JAVA_OPTS", "-Darg=value");Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
Copilot
Metadata
Metadata
Assignees
Labels
No labels