@@ -42,48 +42,15 @@ and building services. These examples can be used as a template for a new projec
4242
4343### Codegen (Gradle)
4444
45- The recommended way to use Smithy Java code generation with Gradle is the
46- [ ** Smithy Java Plugin** ] ( ./gradle-plugin/README.md ) , which handles dependency management,
47- source set wiring, and task ordering automatically:
48-
49- ``` kotlin
50- // build.gradle.kts
51- plugins {
52- id(" software.amazon.smithy.java.gradle.smithy-java" ) version " <smithy-java-version>"
53- }
54- ```
55-
56- Configure your [ ` smithy-build.json ` ] ( https://smithy.io/2.0/guides/smithy-build-json.html ) with the
57- ` java-codegen ` plugin:
58-
59- ``` json
60- {
61- "version" : " 1.0" ,
62- "plugins" : {
63- "java-codegen" : {
64- "service" : " com.example#CoffeeShop" ,
65- "namespace" : " software.amazon.smithy.java.examples" ,
66- "headerFile" : " license.txt" ,
67- "modes" : [" client" ]
68- }
69- }
70- }
71- ```
72-
73- That's it, run ` ./gradlew build ` and the plugin takes care of the rest. See the
74- [ gradle-plugin README] ( ./gradle-plugin/README.md ) for full configuration options,
75- examples (types-only, client, server), and escape hatches.
76-
77- <details >
78- <summary >Manual setup (without the Gradle plugin)</summary >
79-
80- If you prefer manual control, apply [ ` smithy-base ` ] ( https://smithy.io/2.0/guides/gradle-plugin/index.html#smithy-gradle-plugins )
81- directly:
45+ To use the Smithy Java code generators with Gradle, first create a Smithy Gradle project.
8246
8347> [ !NOTE]
8448> You can use the ` smithy init ` [ CLI] ( https://smithy.io/2.0/guides/smithy-cli/index.html ) command to create a new
8549> Smithy Gradle project. The command ` smithy init --template quickstart-gradle ` will create a new basic Smithy Gradle project.
8650
51+ Then apply the [ ` smithy-base ` ] ( https://smithy.io/2.0/guides/gradle-plugin/index.html#smithy-gradle-plugins ) gradle plugin to
52+ your project.
53+
8754``` diff
8855// build.gradle.kts
8956plugins {
@@ -100,8 +67,28 @@ dependencies {
10067}
10168```
10269
103- To compile the generated code as part of your project,
104- add the generated package to your ` main ` sourceSet:
70+ Now, configure your [ ` smithy-build ` ] ( https://smithy.io/2.0/guides/smithy-build-json.html ) to use one of the
71+ Smithy Java codegen plugins. For example, to generate a client for a ` CoffeeShop ` service we would
72+ add the following to our ` smithy-build.json ` :
73+
74+ ``` diff
75+ // smithy-build.json
76+ {
77+ ...
78+ "plugins": {
79+ + "java-codegen": {
80+ + "service": "com.example#CoffeeShop",
81+ + "namespace": "software.amazon.smithy.java.examples",
82+ + "headerFile": "license.txt",
83+ + "modes": ["client"]
84+ + }
85+ }
86+ }
87+ ```
88+
89+ Your project is now configured to generate Java code from our model. To execute a build run the
90+ gradle ` build ` task for your project. To compile the generated code as part of your project,
91+ add the generated package to your ` main ` sourceSet. For example:
10592
10693``` kotlin
10794// build.gradle.kts
@@ -127,8 +114,6 @@ tasks.named("compileJava") {
127114}
128115```
129116
130- </details >
131-
132117### Stability
133118
134119Classes and API's annotated with ` @SmithyInternal ` are for internal use by Smithy-Java libraries and should ** not** be
0 commit comments