Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Apr 5, 2022
1 parent 900c8af commit 61d39cb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;

import javax.inject.Provider;

Expand All @@ -48,7 +49,7 @@ protected AbstractLifecycleProvider( String id, String[] phases, String[] plugin
throw new IllegalArgumentException( "Plugin bindings must have more than 0, even count of elements" );
}

defaultBindings = new HashMap<>( len / 2 );
defaultBindings = new LinkedHashMap<>( len / 2 );

for ( int i = 0; i < len; i += 2 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,15 @@ private void configureResolver( ModelResolver modelResolver, Model model, Defaul
{
try
{
modelResolver.addRepository( repository, replaceRepositories );
try
{
modelResolver.addRepository( repository, replaceRepositories );
}
catch ( AbstractMethodError e )
{
modelResolver.addRepository( new org.apache.maven.model.Repository( repository ),
replaceRepositories );
}
}
catch ( InvalidRepositoryException e )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,33 @@ public Model convertReporting( Model model, ModelBuildingRequest request, ModelP
configChildren.add( newDom( "reportPlugins", reportPlugins, location ) );
configuration = newDom( "configuration", configChildren, location );

sitePlugin = sitePlugin.withConfiguration( configuration );
Plugin finalSitePlugin = sitePlugin.withConfiguration( configuration );

PluginManagement pluginManagement = build.getPluginManagement();
if ( pluginManagement == null )
Plugin sitePluginFromPlugins = build.getPlugins().stream()
.filter( this::isSitePlugin ).findFirst().orElse( null );
if ( sitePluginFromPlugins != null )
{
pluginManagement = PluginManagement.newBuilder()
.plugins( Collections.singletonList( sitePlugin ) )
.build();
List<Plugin> plugins = new ArrayList<>( build.getPlugins() );
plugins.replaceAll( p -> p == sitePluginFromPlugins ? finalSitePlugin : p );
build = build.withPlugins( plugins );
}
else if ( build.getPluginManagement() == null )
{
build = build.withPluginManagement( PluginManagement.newBuilder()
.plugins( Collections.singletonList( finalSitePlugin ) ).build() );
}
else
{
List<Plugin> plugins = new ArrayList<>( pluginManagement.getPlugins() );
plugins.add( sitePlugin );
pluginManagement = pluginManagement.withPlugins( plugins );

Plugin sitePluginFromManagement = build.getPluginManagement().getPlugins().stream()
.filter( this::isSitePlugin ).findFirst().orElse( null );
if ( sitePluginFromManagement != null )
{
List<Plugin> plugins = new ArrayList<>( build.getPluginManagement().getPlugins() );
plugins.replaceAll( p -> p == sitePluginFromManagement ? finalSitePlugin : p );
build = build.withPluginManagement( build.getPluginManagement().withPlugins( plugins ) );
}
}
build = build.withPluginManagement( pluginManagement );

return builder.build( build ).build();
}
Expand Down

0 comments on commit 61d39cb

Please sign in to comment.