@@ -144,25 +144,28 @@ private static NamedDomainObjectContainer<ElasticsearchCluster> testClusters(Pro
144
144
}
145
145
146
146
private static void configurePublishing (Project project , PluginPropertiesExtension extension ) {
147
- if (project .getPlugins ().hasPlugin (MavenPublishPlugin .class )) {
148
- PublishingExtension publishingExtension = project .getExtensions ().getByType (PublishingExtension .class );
149
- MavenPublication elastic = publishingExtension .getPublications ().maybeCreate ("elastic" , MavenPublication .class );
150
- if (extension .isHasClientJar ()) {
151
- project .getTasks ()
152
- .withType (Jar .class )
153
- .configureEach (jar -> jar .getArchiveBaseName ().set (jar .getArchiveBaseName ().get () + "-client" ));
154
- project .getTasks ().withType (GenerateMavenPom .class ).configureEach (pomTask -> {
155
- final BasePluginExtension basepluginExtension = project .getExtensions ().getByType (BasePluginExtension .class );
156
- String archivesName = basepluginExtension .getArchivesName ().get ();
157
- pomTask .setDestination (
158
- new File (project .getBuildDir (), "/distributions/" + archivesName + "-client-" + project .getVersion () + ".pom" )
159
- );
160
- });
161
- elastic .setArtifactId (extension .getName () + "-client" );
162
- } else {
163
- elastic .setArtifactId (extension .getName ());
164
- }
165
- }
147
+ project .getPlugins ().withType (MavenPublishPlugin .class ).configureEach (plugin -> {
148
+ project .afterEvaluate (project1 -> {
149
+ PublishingExtension publishingExtension = project .getExtensions ().getByType (PublishingExtension .class );
150
+ MavenPublication elastic = publishingExtension .getPublications ().maybeCreate ("elastic" , MavenPublication .class );
151
+ if (extension .isHasClientJar ()) {
152
+ project .getTasks ()
153
+ .withType (Jar .class )
154
+ .configureEach (jar -> jar .getArchiveBaseName ().set (jar .getArchiveBaseName ().get () + "-client" ));
155
+ project .getTasks ().withType (GenerateMavenPom .class ).configureEach (pomTask -> {
156
+ final BasePluginExtension basepluginExtension = project .getExtensions ().getByType (BasePluginExtension .class );
157
+ String archivesName = basepluginExtension .getArchivesName ().get ();
158
+ pomTask .setDestination (
159
+ new File (project .getBuildDir (), "/distributions/" + archivesName + "-client-" + project .getVersion () + ".pom" )
160
+ );
161
+ });
162
+ publishingExtension .getPublications ().withType (MavenPublication .class ).configureEach (publication -> {
163
+ publication .setArtifactId (extension .getName () + "-client" );
164
+ });
165
+ publishingExtension .repositories (repositories -> {});
166
+ }
167
+ });
168
+ });
166
169
}
167
170
168
171
private static void configureDependencies (final Project project ) {
0 commit comments