4646 * the plugin is applied:
4747 *
4848 * <ul>
49+ * <li>The {@code https://repo.spring.io/release} Maven repository is configured and
50+ * limited to dependencies in the following groups:
51+ * <ul>
52+ * <li>{@code io.spring.asciidoctor}
53+ * <li>{@code io.spring.docresources}
54+ * </ul>
4955 * <li>All warnings are made fatal.
5056 * <li>The version of AsciidoctorJ is upgraded to 2.4.1.
57+ * <li>An {@code asciidoctorExtensions} configuration is created.
5158 * <li>A task is created to resolve and unzip our documentation resources (CSS and
5259 * Javascript).
5360 * <li>For each {@link AsciidoctorTask} (HTML only):
6471 * the current version, etc.
6572 * <li>{@link AbstractAsciidoctorTask#baseDirFollowsSourceDir() baseDirFollowsSourceDir()}
6673 * is enabled.
74+ * <li>{@code asciidoctorExtensions} is added to the task's configurations.
6775 * </ul>
6876 * </ul>
6977 *
@@ -73,16 +81,20 @@ class AsciidoctorConventions {
7381
7482 private static final String ASCIIDOCTORJ_VERSION = "2.4.1" ;
7583
84+ private static final String EXTENSIONS_CONFIGURATION_NAME = "asciidoctorExtensions" ;
85+
7686 void apply (Project project ) {
7787 project .getPlugins ().withType (AsciidoctorJPlugin .class , (asciidoctorPlugin ) -> {
78- configureDocResourcesRepository (project );
88+ configureDocumentationDependenciesRepository (project );
7989 makeAllWarningsFatal (project );
8090 upgradeAsciidoctorJVersion (project );
91+ Configuration asciidoctorExtensions = createAsciidoctorExtensionsConfiguration (project );
8192 UnzipDocumentationResources unzipResources = createUnzipDocumentationResourcesTask (project );
8293 project .getTasks ().withType (AbstractAsciidoctorTask .class , (asciidoctorTask ) -> {
8394 configureCommonAttributes (project , asciidoctorTask );
8495 configureOptions (asciidoctorTask );
8596 asciidoctorTask .baseDirFollowsSourceDir ();
97+ asciidoctorTask .configurations (asciidoctorExtensions );
8698 Sync syncSource = createSyncDocumentationSourceTask (project , asciidoctorTask );
8799 if (asciidoctorTask instanceof AsciidoctorTask ) {
88100 configureHtmlOnlyAttributes (asciidoctorTask );
@@ -104,10 +116,13 @@ public void execute(Task task) {
104116 });
105117 }
106118
107- private void configureDocResourcesRepository (Project project ) {
119+ private void configureDocumentationDependenciesRepository (Project project ) {
108120 project .getRepositories ().maven ((mavenRepo ) -> {
109121 mavenRepo .setUrl (URI .create ("https://repo.spring.io/release" ));
110- mavenRepo .mavenContent ((mavenContent ) -> mavenContent .includeGroup ("io.spring.docresources" ));
122+ mavenRepo .mavenContent ((mavenContent ) -> {
123+ mavenContent .includeGroup ("io.spring.asciidoctor" );
124+ mavenContent .includeGroup ("io.spring.docresources" );
125+ });
111126 });
112127 }
113128
@@ -119,6 +134,13 @@ private void upgradeAsciidoctorJVersion(Project project) {
119134 project .getExtensions ().getByType (AsciidoctorJExtension .class ).setVersion (ASCIIDOCTORJ_VERSION );
120135 }
121136
137+ private Configuration createAsciidoctorExtensionsConfiguration (Project project ) {
138+ return project .getConfigurations ().create (EXTENSIONS_CONFIGURATION_NAME ,
139+ (configuration ) -> project .getConfigurations ()
140+ .matching ((candidate ) -> "dependencyManagement" .equals (candidate .getName ()))
141+ .all ((dependencyManagement ) -> configuration .extendsFrom (dependencyManagement )));
142+ }
143+
122144 private UnzipDocumentationResources createUnzipDocumentationResourcesTask (Project project ) {
123145 Configuration documentationResources = project .getConfigurations ().maybeCreate ("documentationResources" );
124146 documentationResources .getDependencies ()
0 commit comments