{"id":19901939,"url":"https://github.com/hyperledger-web3j/web3j-gradle-plugin","last_synced_at":"2025-03-16T09:09:31.506Z","repository":{"id":30868825,"uuid":"126242347","full_name":"hyperledger-web3j/web3j-gradle-plugin","owner":"hyperledger-web3j","description":"web3j Gradle plugin","archived":false,"fork":false,"pushed_at":"2024-09-23T03:10:44.000Z","size":389,"stargazers_count":40,"open_issues_count":9,"forks_count":27,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-11-12T20:16:37.362Z","etag":null,"topics":["android","blockchain","ethereum","java","kotlin","solidity","web3j"],"latest_commit_sha":null,"homepage":"https://web3j.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperledger-web3j.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["web3j"]}},"created_at":"2018-03-21T21:23:59.000Z","updated_at":"2024-10-31T18:40:43.000Z","dependencies_parsed_at":"2024-02-16T15:48:48.242Z","dependency_job_id":"daeee21b-d73b-430e-b839-963ed70da631","html_url":"https://github.com/hyperledger-web3j/web3j-gradle-plugin","commit_stats":null,"previous_names":["hyperledger/web3j-gradle-plugin","web3j/web3j-gradle-plugin","hyperledger-web3j/web3j-gradle-plugin"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger-web3j%2Fweb3j-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger-web3j%2Fweb3j-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger-web3j%2Fweb3j-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger-web3j%2Fweb3j-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperledger-web3j","download_url":"https://codeload.github.com/hyperledger-web3j/web3j-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847062,"owners_count":20357317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["android","blockchain","ethereum","java","kotlin","solidity","web3j"],"created_at":"2024-11-12T20:16:40.948Z","updated_at":"2025-03-16T09:09:31.470Z","avatar_url":"https://github.com/hyperledger-web3j.png","language":"Java","funding_links":["https://github.com/sponsors/web3j"],"categories":[],"sub_categories":[],"readme":"Web3j Gradle Plugin\n===================\n\nGradle plugin that generates [Web3j][web3j] Java wrappers from Solidity smart contracts.\nIt smoothly integrates with your project's build lifecycle by adding specific tasks that can be also\nrun independently.\n\n## Plugin configuration\n\nTo configure the Web3j Gradle Plugin using the plugins DSL or the legacy plugin application, \ncheck the [plugin page](https://plugins.gradle.org/plugin/org.web3j). \nThe minimum Gradle version to run the plugin is `5.+`.\n\nThen run your project containing Solidity contracts:\n\n```\n./gradlew build\n```\n\nAfter applying the plugin, the base directory for generated code (by default \n`$buildDir/generated/sources/web3j`) will contain a directory for each source set \n(by default `main` and `test`) containing the smart contract wrappers Java classes.\n\n## Code generation\n\nThe `web3j` DSL allows to configure the generated code, e.g.:\n\n```groovy\nweb3j {\n    generatedPackageName = 'com.mycompany.{0}'\n    generatedFilesBaseDir = \"$buildDir/custom/destination\"\n    excludedContracts = ['Ownable']\n    useNativeJavaTypes = false\n}\n```\n\nThe properties accepted by the DSL are listed in the following table: \n\n|  Name                   | Type       | Default value                       | Description |\n|-------------------------|:----------:|:-----------------------------------:|-------------|\n| `generatedPackageName`  | `String`   | `${group}.web3j` or `org.web3j.{0}` | Generated contract wrappers package. |\n| `generatedFilesBaseDir` | `String`   | `$buildDir/generated/sources/web3j`  | Generated Java code output directory. |\n| `excludedContracts`     | `String[]` | `[]`                                | Excluded contract names from wrapper generation. |\n| `includedContracts`     | `String[]` | `[]`                                | Included contract names from wrapper generation. Has preference over `excludedContracts`. |\n| `useNativeJavaTypes`    | `Boolean`  | `true`                              | Generate smart contract wrappers using native Java types. |\n| `addressBitLength`      | `int`      | `160`                               | Supported address length in bits, by default Ethereum addresses. |\n\nThe `generatedPackageName` is evaluated as a [message format](https://docs.oracle.com/javase/6/docs/api/index.html?java/text/MessageFormat.html) \nstring accepting a single parameter between curly brackets (`{0}`),\nallowing to format the generated value using the contract name. For convenience,\nwhen applied to a Java package name it will be converted to lower case. \n\nFor instance, a `generatedPackageName` set to `${group}.{0}` in a project with group \n`com.mycompany`, a Solidity contract named `MyToken.sol` will be generated in the package\n`com.mycompany.mytoken`.\n\nAlso, the default value contains the `${group}` property, which corresponds to your project artifact \ngroup (e.g. `com.mycompany`). If the project does not define a `group` property, the generated package\nname will be `org.web3j.{0}`.\n\nNote that message format parameters are not Gradle properties and should not be preceded by `$`.\n\n## Source sets\n\nBy default, all `.sol` files in `$projectDir/src/main/solidity` will be processed by the plugin.\nTo specify and add different source sets, use the `sourceSets` DSL:\n\n```groovy\nsourceSets {\n    main {\n        solidity {\n            srcDir 'my/custom/path/to/solidity'\n        }\n    }\n}\n```\n\nCheck the [Solidity Plugin](https://github.com/web3j/solidity-gradle-plugin)\ndocumentation to configure the smart contracts source code directories.\n\nOutput directories for generated smart contract wrappers Java code \nwill be added to your build automatically.\n\n## Plugin tasks\n\nThe [Java Plugin](https://docs.gradle.org/current/userguide/java_plugin.html)\nadds tasks to your project build using a naming convention on a per source set basis\n(i.e. `compileJava`, `compileTestJava`).\n\nSimilarly, the Solidity plugin will add the `generateContractWrappers` task for the project `main`\nsource set, and a `generate[SourceSet]ContractWrappers` for each remaining source set (e.g. `test`). \n\nTo obtain a list and description of all added tasks, run the command:\n\n```\n./gradlew tasks --all\n```\n\n[web3j]: https://web3j.io/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperledger-web3j%2Fweb3j-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperledger-web3j%2Fweb3j-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperledger-web3j%2Fweb3j-gradle-plugin/lists"}