CommunityToolkit.Aspire.Hosting.Java 13.6.1-beta.935

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.Hosting.Java.
dotnet add package CommunityToolkit.Aspire.Hosting.Java --version 13.6.1-beta.935
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Java -Version 13.6.1-beta.935
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.6.1-beta.935" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.6.1-beta.935" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Java --version 13.6.1-beta.935
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Java, 13.6.1-beta.935"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Hosting.Java@13.6.1-beta.935
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.6.1-beta.935&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.6.1-beta.935&prerelease
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Java

Provides extension methods and resource definitions for the Aspire AppHost to support running Java applications. The integration supports Maven, Gradle, and standalone JAR-based applications.

Install the package

In your AppHost project, install the package:

dotnet add package CommunityToolkit.Aspire.Hosting.Java

Add a Java application resource

Run with Maven

Use WithMavenGoal to run the application using a Maven goal:

var app = builder.AddJavaApp("app", "../java-project")
    .WithMavenGoal("spring-boot:run")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Pass additional arguments:

var app = builder.AddJavaApp("app", "../java-project")
    .WithMavenGoal("spring-boot:run", "-Dspring-boot.run.profiles=dev")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Run with Gradle

Use WithGradleTask to run the application using a Gradle task:

var app = builder.AddJavaApp("app", "../java-project")
    .WithGradleTask("bootRun")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Run with a JAR file

To run an existing JAR file, pass the jarPath parameter:

var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Build before run

Use WithMavenBuild or WithGradleBuild to compile the application before it starts. This is typically not needed when using WithMavenGoal or WithGradleTask, as those goals usually handle building automatically.

var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
    .WithMavenBuild()
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Add a containerized Java application

To run a Java application from a container image, use AddJavaContainerApp:

var app = builder.AddJavaContainerApp("app", "my-java-image", "latest")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

JVM configuration

JVM arguments

Use WithJvmArgs to configure JVM arguments:

var app = builder.AddJavaApp("app", "../java-project")
    .WithMavenGoal("spring-boot:run")
    .WithJvmArgs(["-Xmx512m", "-Xms256m"])
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

OpenTelemetry agent

Use WithOtelAgent to configure the OpenTelemetry Java Agent:

var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
    .WithOtelAgent("../agents/opentelemetry-javaagent.jar")
    .WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");

Additional information

Feedback and contributing

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CommunityToolkit.Aspire.Hosting.Java:

Package Downloads
KoalaSoft.Aspire.Hosting.ServiceSources.Java

Java support for KoalaSoft.Aspire.Hosting.ServiceSources — lets an AddService() "local" source clone and run a Java service (Maven goal, Gradle task, or a jar) via the .NET Aspire Community Toolkit's Java integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.6.1-beta.935 42 10/15/2026
13.6.1-beta.933 43 10/13/2026
13.6.1-beta.930 46 10/11/2026
13.6.0 176 10/1/2026
13.6.0-beta.914 61 10/1/2026
13.6.0-beta.910 63 9/30/2026
13.5.1-beta.895 63 9/29/2026
13.5.1-beta.806 62 9/28/2026
13.5.1-beta.803 59 9/28/2026
13.5.1-beta.781 68 9/28/2026
13.5.1-beta.779 59 9/28/2026
13.5.1-beta.777 65 9/28/2026
13.5.1-beta.776 63 9/28/2026
13.5.1-beta.775 70 9/27/2026
13.5.1-beta.770 75 9/25/2026
13.5.1-beta.767 67 9/22/2026
13.5.1-beta.764 69 9/22/2026
13.5.1-beta.763 76 9/21/2026
13.5.1-beta.757 82 9/14/2026
13.5.1-beta.756 58 9/14/2026
Loading failed