File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
docs/src/user-guide/plugins Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,32 @@ plugins:
1751751. `#!yaml <plugin-id>: enabled` is a shorthand; </br>
176176 ` #!yaml <plugin-id>: { enabled: true }` is the full form
177177
178- If we now run the build, we'll see that our generated `com.example.Config` object is present and is visible in the IDE,
178+ If we now run the build, it will fail with an error from our `generateSources` task :
179+ ` ` `
180+ ERROR: Task ':app:generate@build-config' failed: java.lang.IllegalStateException: The file /path/to/project/app/config.properties does not exist
181+ at com.example.GenerateSourcesKt.generateSources(generateSources.kt:19)
182+ ` ` `
183+
184+ That's because we haven't created the `config.properties` file yet, and the code of the task checks for that.
185+ Let's fix it and create the file. As declared in the `plugin.yaml` above, the file is expected in
186+ `${module.rootDir}/config.properties` :
187+
188+ ` ` ` yaml hl_lines="4" title="build-config/plugin.yaml"
189+ tasks:
190+ generate:
191+ action: !com.example.generateSources
192+ propertiesFile: ${module.rootDir}/config.properties
193+ generatedSourceDir: ${taskOutputDir}
194+ # ...the rest is omitted for brevity
195+ ` ` `
196+
197+ In our case, it is `<root>/app/config.properties`. Let's create it with the following content :
198+
199+ ` ` ` properties
200+ APP_NAME=My Cool App
201+ ` ` `
202+
203+ If we run the build again, we'll see that our generated `com.example.Config` object is present and is visible in the IDE,
179204and `"Generating sources"` is being logged to the console.
180205
181206Now let's explore what else we can enhance about our plugin :
You can’t perform that action at this time.
0 commit comments