Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Is there a way to configure Java heap size for the docker container?

Open
#672 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, java, typescript
Domain
cli, devops, tooling

Research direction

Start at apps/generator-cli/src/app/services/pass-through.service.ts around lines 119-124 and trace how useDocker launches the generator. Confirm whether Java options can be passed through; done means documenting or exposing a heap-size setting and verifying generation of a large Java project without the reported error.

Written by the indexing model from the issue text.

Description

When I run openapi-generator-cli on a large OpenAPI file with useDocker, I get the following error when generating Java code:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOf(Unknown Source)
	at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
	at java.base/java.lang.AbstractStringBuilder.append(Unknown Source)
	at java.base/java.lang.StringBuffer.append(Unknown Source)
	at java.base/java.io.StringWriter.write(Unknown Source)
	at com.samskivert.mustache.Template$Segment.write(Template.java:369)
	at com.samskivert.mustache.Mustache$StringSegment.execute(Mustache.java:718)
	at com.samskivert.mustache.Template.executeSegs(Template.java:157)
	at com.samskivert.mustache.Template.execute(Template.java:134)
	at com.samskivert.mustache.Template.execute(Template.java:125)
	at org.openapitools.codegen.templating.MustacheEngineAdapter.compileTemplate(MustacheEngineAdapter.java:65)
	at org.openapitools.codegen.TemplateManager.write(TemplateManager.java:163)
	at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1058)
	at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1045)
	at org.openapitools.codegen.DefaultGenerator.generateSupportingFiles(DefaultGenerator.java:738)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:919)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:465)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

Other languages work fine, and I suspect I just need to give the Java heap some more memory. However, when I look at https://github.com/OpenAPITools/openapi-generator-cli/blob/f3f431db8080a57f788adedd09e2e1aa52ee07b3/apps/generator-cli/src/app/services/pass-through.service.ts#L119-L124, it doesn't appear there's any way to pass in JAVA_OPTS="-Xmx4g" or similar.

Am I missing something? Is there any way to set the max Java heap size?

Dominant language
TypeScript
Stars
2k
Forks
208
Avg merge
7h 12m
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenAPITools/openapi-generator-cli

All issues in OpenAPITools/openapi-generator-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.