Since Gradle 5 we can easily use a bill of materials (BOM) in our build file to get recommended dependency versions. The dependency versions defined in the BOM are dependency constraints in Gradle. This means the dependencies we define in our build that are part of the BOM don’t need a version, because the version is resolved via the dependency constraint that is defined in the BOM. Also transitive dependency versions are resolved using the BOM if applicable. We use the dependency handler method platform
to define the BOM we want to import. The versions in the BOM are recommendations. We can override the recommendation by specifying the version for a dependency found in the BOM with an explicit version.
Continue reading →
From Maven builds we know the dependencyManagement
section in our POM file. In the section we can describe dependencies with their version and later in the dependencies
section we can refer to the dependency without the version. We can use dependency constraints in Gradle to do the same thing. A dependency constraint can be used to define the version or version range for a dependency defined in our scripts or a transitive dependency. Just like a dependency the dependency constraint is defined for a configuration, so we can fine tune the constraints to the correct configuration.
Using dependency constraints in a multi-project build allows us to define the dependency versions in the root build file and define project dependencies per project without a version. The version will then be used from the dependency constraint we defined in the root build file.
Continue reading →
I like to create immutable classes. When using lombok we can easily create immutable classes.
This class Person with the @Value
annotation will create an immutable class with an all args constructor.
The @Builder
will add a Builder pattern to the Person class, so I can use it like this:
Continue reading →
Since Asciidoctor 2.0.0 we can add the collapsible
option to an example block. When the markup is generated to HTML we get a HTML details
and summary
section. The content of the example block is collapsed (default behaviour because it is in a details
section) and a clickable text is available to open the collapsed block (the summary
section), so we can see the actual content. The text we can click on is by default Details, but we can change that by setting the title of the example block. Then the title is used as the text to click on to open the collapsed content.
Continue reading →
With the release of Asciidoctor 2.0.0 we get nice help on the basic syntax of Asciidoc with the command-line option --help syntax
.
This gives us samples of the syntax in Asciidoc markup.
As mentioned by Dan Allen on Twitter we can pipe the syntax sample to Asciidoctor itself to get a HTML page:
Continue reading →