How to add OpenZeppelin compiler into truffle config as an external compiler?

:computer: Environment
Truffle v5.1.45 - a development framework for Ethereum

Oz version:

I am trying to get truffle compile to actually run the command oz compile --optimizer on so that truffle uses the oz compiler. However, I don’t want to just alias it in my terminal. I am trying to figure out how to do this with the compiler object in truffle. Any help would be appreciated.

:1234: Code to reproduce
Current truffle compiler config:

       compilers: {
        external: {
          command: "oz compile --optimizer on",
          targets: [{
            "path": "./build/artifacts/*.json"

And it doesn’t use the oz compiler when I run the compile command

1 Like

Hi @elliot,

Please note: we’ve decided it’s best to focus our upgradeability efforts on the Upgrades Plugins exclusively, and have halted development on the OpenZeppelin CLI. For details see:
Building for interoperability: why we’re focusing on Upgrades Plugins

I had a quick play with the Truffle configuration but didn’t get very far unfortunately.

I was curious as why you wanted to use the OpenZeppelin CLI for compiling in a truffle project?

1 Like

I solved the problem by turning on the optimizer in truffle and then I didn’t need to wire in the oz cli’s compiler to truffle.

1 Like

Hi @elliot,

Glad to hear that you resolved.