{"id":22707584,"url":"https://github.com/xvik/gradle-teavm-plugin","last_synced_at":"2026-05-08T17:33:35.181Z","repository":{"id":145081909,"uuid":"582628175","full_name":"xvik/gradle-teavm-plugin","owner":"xvik","description":"Gradle TeaVM plugin","archived":false,"fork":false,"pushed_at":"2026-05-05T05:49:44.000Z","size":485,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-05T07:27:30.052Z","etag":null,"topics":["gradle","gradle-plugin","java","javascript","teavm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xvik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-27T12:09:50.000Z","updated_at":"2026-05-05T05:49:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"861a7798-26a6-495c-a474-deb1be0cd03b","html_url":"https://github.com/xvik/gradle-teavm-plugin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xvik/gradle-teavm-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgradle-teavm-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgradle-teavm-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgradle-teavm-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgradle-teavm-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xvik","download_url":"https://codeload.github.com/xvik/gradle-teavm-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgradle-teavm-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32790377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","gradle-plugin","java","javascript","teavm","webassembly"],"created_at":"2024-12-10T10:13:28.873Z","updated_at":"2026-05-08T17:33:35.160Z","avatar_url":"https://github.com/xvik.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gradle-teavm-plugin\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://www.opensource.org/licenses/MIT)\n[![CI](https://github.com/xvik/gradle-teavm-plugin/actions/workflows/CI.yml/badge.svg)](https://github.com/xvik/gradle-teavm-plugin/actions/workflows/CI.yml)\n[![Appveyor build status](https://ci.appveyor.com/api/projects/status/github/xvik/gradle-teavm-plugin?svg=true)](https://ci.appveyor.com/project/xvik/gradle-teavm-plugin)\n[![codecov](https://codecov.io/gh/xvik/gradle-teavm-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/xvik/gradle-teavm-plugin)\n\n### About\n\nGradle [TeaVM](https://teavm.org/) plugin: java/kotlin/scala compilation to JS or WASM.\nIn contrast to [GWT](https://www.gwtproject.org/), teavm works with compiled bytecode (sources not required for compilation).\n\n**Unofficial** gradle plugin. Differences with [official teavm plugin](https://teavm.org/docs/tooling/gradle.html):\n- Single `teavmCompile` task and single configuration (instead of per type (js/wasm/etc.) configurations)\n- Dev mode support (easy switching to dev configuration)\n- Configurable compiler version (official plugin release together with teavm and so targets exact version, while this plugin detects version from classpath)\n- No tests support ([must be configured manually](examples/java/build.gradle))\n\nFeatures:\n* Automatic teavm compiler version selection\n* Dev mode support\n\n##### Summary\n\n* Configuration: `teavm`\n* Tasks:\n    - `compileTeavm` - compile sources       \n\n### Setup\n\n[![Maven Central](https://img.shields.io/maven-central/v/ru.vyarus/gradle-teavm-plugin.svg)](https://maven-badges.herokuapp.com/maven-central/ru.vyarus/gradle-teavm-plugin)\n[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/ru.vyarus/teavm/ru.vyarus.teavm.gradle.plugin/maven-metadata.xml.svg?colorB=007ec6\u0026label=plugins%20portal)](https://plugins.gradle.org/plugin/ru.vyarus.teavm)\n\n```groovy\nplugins {\n    id 'ru.vyarus.teavm' version '1.2.0'\n}\n```\n\nOR\n\n```groovy\nbuildscript {\n    repositories {\n        gradlePluginPortal()\n    }\n    dependencies {\n        classpath 'ru.vyarus:gradle-teavm-plugin:1.2.0'\n    }\n}\napply plugin: 'ru.vyarus.teavm'\n``` \n\n### Compatibility\n\nNOTE: Java 11 or above is required (teavm compiled for java 11).\n\nGradle | Version\n--------|-------\n6.2-8   | 1.2.0\n\n### Usage\n\nExample projects:\n\n* [Java](examples/java)\n* [Kotlin](examples/kotlin)\n* [Scala](examples/scala)\n\n####  TeaVM dependencies\n\nTeaVM often publish fresh [dev versions](https://teavm.org/docs/intro/preview-builds.html) into separate repository. \nIf you want to use dev build instead of release version, add custom repository:\n\n```groovy\next {\n  teavm = '0.9.0-dev-15'\n}\nrepositories { \n  mavenCentral()\n  maven { url \"https://teavm.org/maven/repository\" }\n}\ndependencies {\n    implementation \"org.teavm:teavm-classlib:$teavm\"\n    implementation \"org.teavm:teavm-jso-apis:$teavm\"\n}\n```\n\nYou can check the latest published dev build [directly in repository](https://teavm.org/maven/repository/org/teavm/teavm-core/)\n\n#### Flavour\n\nNOTE: [flavour](https://github.com/konsoletyper/teavm-flavour) is not currently maintained and\nits dev builds are not published (so you can use only the latest released 0.2.1).\nCurrent flavour is *not compatible* with teavm 0.9\n\n* [Flavour example](examples/flavour) *for teavm 0.8\n\nMaintained flavour **fork**: [site](https://flavour.sourceforge.io/), [flavour docs](https://frequal.com/teavm-site/docs/flavour/templates.html) (removed from teavm site),\n[source](https://sourceforge.net/projects/flavour/) (still not yet compatible with 0.9), [teavm 0.11 compatible PR](https://github.com/konsoletyper/teavm-flavour/pull/78) (not accepted, but fork still present)\n\n#### Plugin configuration\n\nThe only required configuration is entry point main class:\n\n```groovy\nteavm {\n  dev = false\n  mainClass = 'com.foo.Client'\n}\n```\n\nBy default, plugin configured for JS production compilation, but you can set dev option \nto true to enable development options (source maps, faster compilation etc.).\n\nNOTE: if you use flavour and want to put html (or other) resources together with source files\nthen activate `teavm.mixedResources` option (it would configure `processResources` task to work from source dirs)\n\n#### Output configuration\n\ncompileTeavm task simply compiles java/kotlin/scala (compiled) classes into js (or wasm).\nWith dev options, it will also create debug file (for IDEA), source maps and copy all\nsources into target directory (to let you debug code directly in browser with source maps).\n\nExample webapp build task:\n\n```groovy\ntasks.register('buildWebapp', Copy) {\n    from('src/main/webapp')\n    from(compileTeavm) {\n        into 'js'\n    }\n    into 'build/webapp'\n}\n```\n\nEach time `buildWebapp` would be called, teavm compilation would be called too\npreparing webapp inside `build/webapp` directory (you can run index.html from there to test compiled application)\n\n\nFor some cases it might be preferable to compile teavm directly into prepared webapp directory\n(e.g. when webapp resources preparation took significant time): \n\n```groovy\nteavm {\n  targetDir = 'build/webapp'\n}\n\ntasks.register('buildWebapp', Copy) {\n    from('src/main/webapp')   \n    into 'build/webapp'\n}\n```\n\nThis way, `buildWebapp` copies webapp resources without compiled js and you should call\n`compileTeavm` in order to add (or refresh) js.\n\n#### Web\n\nIn html file you only need to include compiled js file:\n\n```html\n\u003cscript type=\"text/javascript\" charset=\"utf-8\" src=\"js/classes.js\"\u003e\u003c/script\u003e\n```\n\n### IDEA\n\nTeaVM IDEA plugin provides [dev and debug servers](https://teavm.org/docs/tooling/idea.html). These are only available in plugin and can't be\nimplemented as gradle tasks.\n\nIMPORTANT: idea plugin version, published into official repository is stale and you need\nto declare custom plugins repository:\n  Open Settings -\u003e Plugins -\u003e Browse repositories... -\u003e Manage repositories... \n  Click Add button and enter https://teavm.org/idea/dev/teavmRepository.xml \n  Then get back to Browse repositories and pick TeaVM plugin from list.\n\n### Configuration \n\n`teavm` options with default values:\n\n```groovy\n{\n    /**\n     * Enables dev mode: use options from \"devOptions\" configuration.\n     */\n    dev = false\n    /**\n     * Prints plugin debug information: used paths, dependencies, resolved sources and complete teavm stats.\n     */\n    debug = false\n    /**\n     * Configures processResources task to load resources from java/kotlin/scala directories (ignoring compiled\n     * sources). Useful for flavour when html templates stored near source files.\n     */\n    mixedResources = false\n    /**\n     * Detect teavm version from classpath (see \"configurations\") in order to use the same version for compilation.\n     * When enabled, \"version\" option is ignored.\n     */\n    autoVersion = true\n    /**\n     * Teavm version to use. Ignored when \"autoVersion\" enabled.\n     */\n    version = \"0.9.0\"\n\n    /**\n     * Source sets to compile js from. By default, java, kotlin and scala supported.\n     */\n    sourceSets = [\"main\", \"kotlin\", \"scala\"]\n    /**\n     * Configurations with required dependencies (by default, runtimeClasspath). There is no alternative for direct\n     * dependency jars specification - local jar files could always be configured in configuration.\n     */\n    configurations = [\"runtimeClasspath\"]\n    /**\n     * Additional directories with compiled classes. Normally, this should not be needed as \"sourceSets\"\n     * already describe required directories. Could be useful only for specific cases.\n     * Values: strings with absolute or relative directories locations. \n     */\n    extraClassDirs = []\n    /**\n     * Additional source directories (used only when \"sourceFilesCopied\" enabled). Normally, this should not\n     * be needed as sources already described with \"sourceSets\" and dependencies sources are resolved\n     * from \"configurations\".\n     * All jars contained in configured directories (1st level) would be also added.\n     * Values: strings with absolute or relative directories locations. \n     */\n    extraSourceDirs = []\n    /**\n     * Target compilation directory. By default, \"build/teavm\".\n     */\n    targetDir = 'build/teavm'\n    /**\n     * Teavm cache directory. By default, \"build/teavm-cache\".\n     */\n    cacheDir = 'build/teavm-cache'\n\n    /**\n     * Main application class (required).\n     */\n    mainClass\n    /**\n     * Entry point name (entry static method).\n     */\n    entryPointName = \"main\"\n    /**\n     * Output file name. By default, empty to let teavm automatically select file name by compilation target:\n     * classes.js, classes.wasm, etc. (see org.teavm.tooling.TeaVMTool#getResolvedTargetFileName()).\n     */\n    targetFileName = \"\"\n    /**\n     * Compilation target: js by default. Values: JAVASCRIPT, WEBASSEMBLY, WEBASSEMBLY_WASI, C\n     */\n    targetType = JAVASCRIPT\n    /**\n     * Javascript module type: UMD by default. Values: COMMON_JS, UMD, NONE, ES2015\n     */\n    jsModuleType = UMD\n    /**\n     * Target wasm version (only for compilation to WASM). Values: V_0x1\n     */\n    wasmVersion = V_0x1\n\n    /**\n     * Fail on compilation error.\n     */\n    stopOnErrors = true\n    /**\n     * Minify files. Should be enabled for production, but disabled for dev.\n     */\n    obfuscated = true\n    /**\n     * Strict teavm mode.\n     */\n    strict = false\n    /**\n     * Copy java sources into generated folder so they could be loaded in browser through source maps (see\n     * \"sourceMapsGenerated\").\n     */\n    sourceFilesCopied = false\n    /*\n     * Put links to local source files instead of copying them. Do nothing when \"sourceFilesCopied\" disabled.\n     * Make sense only for local development.\n     */\n    sourceFilesCopiedAsLocalLinks = false\n    /**\n     * Incremental compilation speeds up compilation, but limits some optimizations and so should be used only\n     * in dev mode.\n     */\n    incremental = false\n    /**\n     * Generate debug information required for debug server (started from IDE).\n     */\n    debugInformationGenerated = false\n    /**\n     * Generate source maps. In oder to be able to debug sources in browser enable \"sourceFilesCopied\".\n     */\n    sourceMapsGenerated = false\n    /**\n     * Short file names. ONLY for C target.\n     */\n    shortFileNames = false\n    /**\n     * Heap dump. ONLY for C target.\n     */\n    heapDump = false\n    /**\n     * Fast dependency analysis. Probably, could speed up compilation. ONLY for development! (option disables\n     * \"optimizationLevel\" setting).\n     */\n    fastDependencyAnalysis = false\n    /**\n     * Remove assertions.\n     */\n    assertionsRemoved = false        \n\n    /**\n     * Top-level names limit. ONLY for JS target.\n     */\n    maxTopLevelNames = 80000\n    /**\n     * Minimal heap size (in mb). ONLY for WASM and C targets.\n     */\n    minHeapSize = 4\n    /**\n     * Maximum heap size (in mb). ONLY for WASM and C targets.\n     */\n    maxHeapSize = 128\n    /**\n     * Output optimization level.\n     * SIMPLE – perform only basic optimizations, remain friendly to the debugger (recommended for development).\n     * ADVANCED – perform more optimizations, sometimes may stuck debugger (recommended for production).\n     * FULL – perform aggressive optimizations, increase compilation time, sometimes can make code even slower\n     * (recommended for WebAssembly).\n     */\n    optimizationLevel = ADVANCED\n    /**\n     * An array of fully qualified class names. Each class must implement\n     * \"org.teavm.model.ClassHolderTransformer\" interface and have a public no-argument constructor. These\n     * transformers are used to transform ClassHolders, that are SSA-based representation of JVM classes. Transformers\n     * run right after parsing JVM classes and producing SSA representation.\n     */\n    transformers = []\n    /**\n     * Properties passed to all TeaVM plugins (usage examples unknown).\n     * Values: map of strings (key and value) \n     */\n    properties = [:]\n    /**\n     * Fully qualified class names to preserve (probably, to avoid remove by dependency analysis).\n     */\n    classesToPreserve=[]\n\n```\n\nNOTE: enum values for options `optimizationLevel`, `wasmVersion` and `targetType`\ncould be used without quotes because all values are pre-configured by plugin as constants\n\n\n`devOptions` section configures overrides for some values for dev mode (enabled with `dev = true`):\n\n```groovy\nteavm {\n  devOptions {\n    obfuscated = false\n    strict = false\n    sourceFilesCopied = true\n    sourceFilesCopiedAsLocalLinks = true\n    incremental = false\n    debugInformationGenerated = true\n    sourceMapsGenerated = true\n    fastDependencyAnalysis = false\n    assertionsRemoved = false\n    optimizationLevel = SIMPLE\n    \n    // C target ONLY\n    shortFileNames = false\n    heapDump = false\n  }\n}\n```\n\n#### Sources configuration\n\nExtension is configured based on source sets. By default:\n\n```groovy\nteavm.sourceSets = [\"main\", \"kotlin\", \"scala\"]\n```\n\nFor all found source sets (from list) compiled classes and source directories\nwould be automatically configured for teavm.\n\nIf you have additional sources or don't want to rely on source sets use\n\n```groovy\nteavm {\n  extraClassDirs = ['/path/to/classes']\n  extraSourceDirs = ['/path/to/sources']\n}\n```\n\n(normally, you don't need to declare any additional directories as sourcesets describe everything)\n\n`configurations` option declares teavm dependencies. By default:\n\n`teavm.configurations = ['runtimeClasspath']`\n\nAll jars from provided configurations would be passed to teavm.\nAlso, if sources generation enabled, source jars would be resolved.\n\nIn case if you have some custom library with jars, still use configuration to declare them.\nAdditional source jars might be declared in `extraSourceDirs`: all jars found in extra source\ndirs used as source jars.\n\n#### TeaVM version\n\nPlugin is compiled with exact teavm version (and so supports only options available in this version). \nBut, at runtime, it could run with different version.\nBy default, required teavm version is detected from classpath. This behaviour could be\ndisabled with `teavm.autoVersion=false`.\n\nWhen auto version disabled or can't be resolved, version from `teavm.version` used.\n\n#### Development\n\nOptions related to development are duplicated in the main closure and `devOptions`.\nThis way, top closure declares production configuration and `devOptions` for \ndev mode (`dev = true`).\n\n#### Debug\n\n```groovy\nteavm.debug = true\n```\n\nactivates debug mode to show all paths resolved from source sets, classpath jars,\nloaded source jars and all used teavm files.\n\n### Custom task\n\nYou can configure custom teavm task if required:\n\n```groovy\ntasks.register('myTeavm', TeavmCompileTask) {\n  ...\n}\n```\n\nExtension values are applied to all compile tasks, so you may need to change only \ndifferent values.\n\nOptions list:\n\n```groovy\n  debug = false\n  classPath = \n  dependencies =\n  sources = \n  sourceDependencies =  \n  targetDir = \n  cacheDir =\n  mainClass = \n  entryPointName =  \n  targetFileName =\n  targetType = \n  jsModuleType =\n  wasmVersion =\n  stopOnErrors = \n  obfuscated = \n  strict =\n  sourceFilesCopied =\n  incremental =   \n  debugInformationGenerated =   \n  sourceMapsGenerated =  \n  shortFileNames =\n  heapDump =\n  fastDependencyAnalysis =\n  assertionsRemoved =        \n  maxTopLevelNames =\n  minHeapSize =\n  maxHeapSize =\n  optimizationLevel =\n  transformers =\n  properties =  \n  classesToPreserve =        \n```\n\nTask options are almost the same as in configuration except compiled classes dirs, source dirs and dependencies \nconfiguration: task does not use sourceSets or configurations, instead it accepts direct \nlists. This is required for proper up-to-date behaviour (so task could correctly detect changes)\n\nSo completely custom task configuration would look like:\n\n```groovy\ntasks.register('myTeavm', TeavmCompileTask) {\n  // list of dirs with compiled classes\n  classPath = [layout.buildDirectory.dir('generated-source')]\n  // all required jars\n  dependencies = configurations.findByName('custom')   \n  // sources required ONLY when sourceFilesCopied = true \n  sources = [layout.projectDirectory.dir('src/main/java')]\n}\n```\n\nFor more info about working with gradle properties see [gradle docs](https://docs.gradle.org/current/userguide/lazy_configuration.html#working_with_task_dependencies_in_lazy_properties)\n\nAll teavm tasks would depend on `classes` task to compile java/kotlin/scala and process resources\nbefore teavm start.\n\n---\n[![gradle plugin generator](http://img.shields.io/badge/Powered%20by-%20Gradle%20plugin%20generator-green.svg?style=flat-square)](https://github.com/xvik/generator-gradle-plugin)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgradle-teavm-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxvik%2Fgradle-teavm-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgradle-teavm-plugin/lists"}