-
Notifications
You must be signed in to change notification settings - Fork 12
Adds README section about dynamically added dependencies #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,26 @@ Here is an example command to let Gradle add all dependency artifacts to your `v | |
gradle --refresh-dependencies --write-verification-metadata sha256 --write-locks dependencies | ||
``` | ||
|
||
Note that in Gradle projects where dependencies are specified dynamically inside a Gradle task, you need to run the same command above, but replace `dependencies` with the specific Gradle task where dependencies are dynamically specified. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure if replacing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree! What I tried to convey was that you first run the I'll add a new heading and rephrase everything a bit and see if I can come up with something that is more clear. |
||
For example, imagine that you have a Gradle project with a sub-module written in Groovy, where some additional dependencies are added inside the `compileGroovy` task. If you would try to build your project, you will see a similar error like this: | ||
|
||
``` | ||
Execution failed for task ':my-submodule:compileGroovy'. | ||
> Could not resolve all files for configuration ':my-submodule:detachedConfiguration1'. | ||
> Could not find org.apache.groovy:groovy-astbuilder:4.0.21. | ||
Required by: | ||
project :my-submodule | ||
project :my-submodule > org.apache.groovy:groovy:4.0.21 > org.apache.groovy:groovy-bom:4.0.21 | ||
``` | ||
|
||
In order to solve those problems, you need to tell Gradle to execute the task `compileGroovy` instead of the `dependencies` task, along with the flags mentioned above. Like this: | ||
|
||
```bash | ||
gradle --refresh-dependencies --write-verification-metadata sha256 --write-locks compileGroovy | ||
``` | ||
|
||
Now you will notice that the `verification-metadata.xml` file will contain those extra missing dependencies that you got an error for earlier. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When adding headings, I would add another heading here (something like |
||
Gradle not remove any artefacts from the `verification-metadata.xml` even if they are not used anymore. This can lead to . The `updateVerificationMetadata` package from this flake can be used to re-generate the file while keeping the `<configuration>` section. You must ensure that the Gradle version and JDK version align. | ||
|
||
```bash | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could give this section a title of its own, e.g.
Detached Configurations
(can't think of anything better at the moment - may be more descriptive...).