CommunityToolkit.Aspire.Hosting.Java 13.5.1-beta.806

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.Hosting.Java.
dotnet add package CommunityToolkit.Aspire.Hosting.Java --version 13.5.1-beta.806
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Java -Version 13.5.1-beta.806
                    
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.5.1-beta.806" />
                    
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.5.1-beta.806" />
                    
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.5.1-beta.806
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Java, 13.5.1-beta.806"
                    
#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.5.1-beta.806
                    
#: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.5.1-beta.806&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.5.1-beta.806&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.5.1-beta.806 24 9/28/2026
13.5.1-beta.803 25 9/28/2026
13.5.1-beta.781 27 9/28/2026
13.5.1-beta.779 25 9/28/2026
13.5.1-beta.777 28 9/28/2026
13.5.1-beta.776 29 9/28/2026
13.5.1-beta.775 33 9/27/2026
13.5.1-beta.770 36 9/25/2026
13.5.1-beta.767 44 9/22/2026
13.5.1-beta.764 40 9/22/2026
13.5.1-beta.763 55 9/21/2026
13.5.1-beta.757 67 9/14/2026
13.5.1-beta.756 51 9/14/2026
13.5.1-beta.754 58 9/14/2026
13.5.1-beta.752 59 9/12/2026
13.5.1-beta.751 66 9/12/2026
13.5.1-beta.748 78 9/7/2026
13.5.1-beta.744 67 9/7/2026
13.5.1-beta.743 75 9/7/2026
13.5.1-beta.736 69 9/1/2026
Loading failed