Skip to content
CCPEDIAby Unity Nodes
App Development

Codegen Java dpm

8 posts127 viewsLast activity Aug 2026

  1. austinOP

    Hi,

    I am on dpm 3.5.4 or version 1.0.21 and I am attempting to generate java bindings for my dar. I went to run dpm codegen-java and it seems like that command no longer exists? Was it moved to a different location within dpm?

    Thanks,

    Austin

  2. Federico_Rodriguez

    Hey, codegen and its codegen-java command, are included in the 3.5.4 bundle.

    If that is not the case for you, here are a few things to check:

    1. Check which DPM is running

    which dpm
    dpm version --active
    dpm --version
    
    

    Expected active SDK: 3.5.4.

    2. Check environment overrides

    echo "$DPM_HOME"
    echo "$DPM_SDK_VERSION"
    echo "$DPM_REGISTRY"
    echo "$DPM_EDITION"
    
    

    Watch for DPM_HOME pointing somewhere unexpected, or DPM_SDK_VERSION overriding the SDK away from 3.5.4.

    3. Check whether the project config overrides SDK components

    find .. -name daml.yaml -o -name multi-package.yaml
    rg -n "sdk-version|components:" daml.yaml multi-package.yaml ../*/daml.yaml ../*/multi-package.yaml
    
    

    If components: is present, DPM may ignore the bundled SDK components and only expose explicitly listed components. Make sure codegen is included.

    4. Check DPM’s resolved component set

    dpm resolve --output json | jq '.DefaultSDK, .Packages'
    
    

    For 3.5.4, expect to see:

    "codegen": {
      "version": "3.5.2"
    }
    
    

    5. Check the installed SDK manifest

    cat ~/.dpm/cache/sdk/open-source/3.5.4.yaml
    
    

    Expected:

    codegen:
      version: 3.5.2
    
    

    6. Check the codegen component itself

    cat ~/.dpm/cache/components/codegen/3.5.2/component.yaml
    ls -l ~/.dpm/cache/components/codegen/3.5.2/binary.jar
    
    

    In component.yaml, expect:

    name: codegen-java
    
    

    7. Try the command directly

    dpm codegen-java --help
    
    

    Expected:

    codegen-java 3.5.2
    
    
  3. austin

    Hi Federico, thanks for the response! I see everything that you are expecting me to see. However, when I actually run dpm codegen-java I get Error: unknown command "codegen-java" for "dpm"Run 'dpm --help' for usage. Then when I run dpm help there is no codgen-java command visible:

    dpm help
    Usage:
    dpm [command]

    Meta Commands
    add Add components and dars to project
    install Install project’s dependencies or specific dpm-sdk version
    publish Commands for publishing artifacts
    tags List published tags of an artifact
    uninstall Uninstall a dpm-sdk version
    update Update project dependencies
    version Show sdk versions

    Dpm Commands
    build Build a Daml package or project
    clean Clean a Daml package or project
    damlc Compiler and IDE backend for the Daml programming language
    docs Generate documentation for a daml package from its documentation comments
    inspect-dar Inspect a DAR archive
    script Daml Script Binary
    studio Launch Daml Studio
    test Test the current Daml project or the given files by running all test declarations.
    validate-dar Validate a DAR archive

    Additional Commands:
    completion Generate the autocompletion script for the specified shell
    help Help about any command

    Flags:
    -h, --help help for dpm
    -v, --version version for dpm

    Use “dpm [command] --help” for more information about a command.

  4. Federico_Rodriguez

    Your dpm help output is missing more than just codegen-java. A normal full 3.5.4 installation should also show commands such as:

    • codegen-js

    • sandbox

    • canton-console

    • new

    • init

    • pqs

    • upgrade-check

    • daml-shell

    The commands you do see mostly come from damlc plus daml-script, so DPM is likely resolving a reduced component set in that directory rather than the full bundled 3.5.4 SDK.

    1. Check the current directory and environment

    Run:

    pwd
    env | sort | grep -E '^(DPM_|DAML_)'
    
    

    In particular, look for any of these variables:

    DPM_ASSEMBLY
    DPM_SDK_VERSION
    DPM_HOME
    DAML_PACKAGE
    DAML_PROJECT
    DPM_MULTI_PACKAGE
    
    

    2. Check for project-specific components

    Run:

    find .. -name daml.yaml -o -name multi-package.yaml
    grep -R "components:" -n daml.yaml multi-package.yaml ../*/daml.yaml ../*/multi-package.yaml 2>/dev/null
    
    

    If components: is present, DPM may be using the explicitly configured components rather than the full SDK bundle.

    In that case, make sure codegen is included:

    components:
      codegen:
        version: 3.5.2
    
    

    3. Test outside the project

    To determine whether this is caused by project-local configuration, try from /tmp:

    cd /tmp
    dpm version --active
    dpm help
    

    If codegen-java is present when running dpm on /tmp, the issue is almost certainly related to the project-local configuration.

    If it is still not present, please send the output of:

    dpm resolve --output json
    cat ~/.dpm/cache/sdk/open-source/3.5.4.yaml
    cat ~/.dpm/cache/components/codegen/3.5.2/component.yaml
    
    

    That should show whether DPM is resolving the expected 3.5.4 SDK and whether the codegen component is installed and registered correctly.

  5. austin

    It seems like the issue was in my multi-package.yaml file with the components! I only had script and damlc listed, I’ve added codegen and it now appears. Thank you! Do you know what would’ve caused version 3.5.2 to have all commands available by default and then 3.5.4 to need codegen explicity listed in the multi-package.yaml? Maybe a config update?

  6. Federico_Rodriguez

    I am not aware of this behavior changing recently. If the project explicitly declares components, DPM will resolve the component set from that project configuration. If you remove the components field then you should get the full sdk bundle.

  7. austin

    Ah ok, I’ll give that a shot. Maybe it has something to do with the fact that I have both dpm 3.5.2 and 3.5.4 installed

  8. sormeter

    yeah if you specify sdk-version it will include the full bundle of all the components – which you may or may not need

    if you want to more closely control and use only the components of interest, you can use the components: block

    this can be specified at the multi-package.yaml top-level, and will then inherit down to the individual daml.yaml

    if you have one value set at the top level (multi package says sdk-version:3.5.2) and a separate value set within a project (daml.yaml says sdk-version:3.5.4), the child daml.yaml value wins

    hope this helps