public List<Dependency> getDependencies() { return plugin.getDependencies(); }
/** * Method addDependency. * * @param dependency */ public void addDependency( Dependency dependency ) { getDependencies().add( dependency ); } //-- void addDependency( Dependency )
/** * Method removeDependency. * * @param dependency */ public void removeDependency( Dependency dependency ) { getDependencies().remove( dependency ); } //-- void removeDependency( Dependency )
protected void mergePlugin_Dependencies( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context ) { List<Dependency> src = source.getDependencies(); if ( !src.isEmpty() ) { List<Dependency> tgt = target.getDependencies(); Map<Object, Dependency> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 ); for ( Dependency element : tgt ) { Object key = getDependencyKey( element ); merged.put( key, element ); } for ( Dependency element : src ) { Object key = getDependencyKey( element ); if ( sourceDominant || !merged.containsKey( key ) ) { merged.put( key, element ); } } target.setDependencies( new ArrayList<>( merged.values() ) ); } }
public static boolean pluginEquals( Plugin a, Plugin b ) { return Objects.equals( a.getArtifactId(), b.getArtifactId() ) // && Objects.equals( a.getGroupId(), b.getGroupId() ) // && Objects.equals( a.getVersion(), b.getVersion() ) // && a.isExtensions() == b.isExtensions() // && dependenciesEquals( a.getDependencies(), b.getDependencies() ); }
public static int pluginHashCode( Plugin plugin ) { int hash = 17; hash = hash * 31 + Objects.hashCode( plugin.getGroupId() ); hash = hash * 31 + Objects.hashCode( plugin.getArtifactId() ); hash = hash * 31 + Objects.hashCode( plugin.getVersion() ); hash = hash * 31 + ( plugin.isExtensions() ? 1 : 0 ); for ( Dependency dependency : plugin.getDependencies() ) { hash = hash * 31 + Objects.hashCode( dependency.getGroupId() ); hash = hash * 31 + Objects.hashCode( dependency.getArtifactId() ); hash = hash * 31 + Objects.hashCode( dependency.getVersion() ); hash = hash * 31 + Objects.hashCode( dependency.getType() ); hash = hash * 31 + Objects.hashCode( dependency.getClassifier() ); hash = hash * 31 + Objects.hashCode( dependency.getScope() ); for ( Exclusion exclusion : dependency.getExclusions() ) { hash = hash * 31 + Objects.hashCode( exclusion.getGroupId() ); hash = hash * 31 + Objects.hashCode( exclusion.getArtifactId() ); } } return hash; }
private void mergeDeterministicPluginElements( List iPlugins, List dPlugins ) { if ( dPlugins != null ) { for ( int i = 0; i < dPlugins.size(); i++ ) { Plugin dPlugin = (Plugin) dPlugins.get( i ); Plugin iPlugin = (Plugin) iPlugins.get( i ); dPlugin.setGroupId( iPlugin.getGroupId() ); dPlugin.setArtifactId( iPlugin.getArtifactId() ); dPlugin.setVersion( iPlugin.getVersion() ); dPlugin.setDependencies( iPlugin.getDependencies() ); List dExecutions = dPlugin.getExecutions(); if ( dExecutions != null ) { List iExecutions = iPlugin.getExecutions(); for ( int j = 0; j < dExecutions.size(); j++ ) { PluginExecution dExec = (PluginExecution) dExecutions.get( j ); PluginExecution iExec = (PluginExecution) iExecutions.get( j ); dExec.setId( iExec.getId() ); } } } } }
@Override public void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { injectDependencyDefaults( model.getDependencies() ); Build build = model.getBuild(); if ( build != null ) { for ( Plugin plugin : build.getPlugins() ) { injectDependencyDefaults( plugin.getDependencies() ); } } }
modelPlugin.setDependencies( injectDependencies( profilePlugin.getDependencies(), modelPlugin.getDependencies() ) );
child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) );
private void validate20EffectivePluginDependencies( ModelProblemCollector problems, Plugin plugin, ModelBuildingRequest request ) { List<Dependency> dependencies = plugin.getDependencies(); if ( !dependencies.isEmpty() ) { String prefix = "build.plugins.plugin[" + plugin.getKey() + "].dependencies.dependency."; Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); for ( Dependency d : dependencies ) { validateEffectiveDependency( problems, d, false, prefix, request ); validateVersion( prefix + "version", problems, errOn30, Version.BASE, d.getVersion(), d.getManagementKey(), d ); validateEnum( prefix + "scope", problems, errOn30, Version.BASE, d.getScope(), d.getManagementKey(), d, "compile", "runtime", "system" ); } } }
for ( Iterator k = plugin.getDependencies().iterator(); k.hasNext(); )
plugin.getArtifactId(), plugin.getVersion(), false, true ); for ( Dependency dependency : plugin.getDependencies() )
private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project ) { Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() ); if ( pluginInPom == null && project.getPluginManagement() != null ) { pluginInPom = findPlugin( plugin, project.getPluginManagement().getPlugins() ); } if ( pluginInPom != null ) { if ( plugin.getVersion() == null ) { plugin.setVersion( pluginInPom.getVersion() ); } plugin.setDependencies( new ArrayList<>( pluginInPom.getDependencies() ) ); } }
child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) );
if ( ( plugin.getDependencies() != null ) && ( plugin.getDependencies().size() > 0 ) ) for ( Iterator iter = plugin.getDependencies().iterator(); iter.hasNext(); )
public static Plugin clonePlugin( Plugin src ) { Plugin result = null; if ( src != null ) { result = new Plugin(); result.setArtifactId( src.getArtifactId() ); result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) ); result.setExecutions( cloneList( src.getExecutions(), PLUGIN_EXECUTION_CLONER ) ); result.setExtensions( src.isExtensions() ); result.setGroupId( src.getGroupId() ); result.setInherited( src.getInherited() ); result.setVersion( src.getVersion() ); } return result; }
private void writePlugin(Plugin plugin, String indent) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(plugin.getGroupId() + ":" + plugin.getArtifactId()); if (plugin.getVersion() != null) { sb.append(":" + plugin.getVersion()); } out.write(indent + "plugin(\"" + sb.toString() + "\")" + br); if (plugin.getExtensions() != null) { out.write(indent + " .extensions(" + plugin.getExtensions() + ")" + br); } if (plugin.getInherited() != null) { out.write(indent + " .inherited(" + plugin.getInherited() + ")" + br); } if (plugin.getDependencies() != null && !plugin.getDependencies().isEmpty()) { out.write(indent + " " + ".dependencies(" + br); writePluginDependency(plugin.getDependencies(), indent); out.write(indent + " " + ")" + br); } writeConfiguration((Xpp3Dom)plugin.getConfiguration(), indent); out.write(indent + ".endPlugin()" + br); }
request.setRepositories( repositories ); request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) ); for ( Dependency dependency : plugin.getDependencies() )
( !plugin.getExecutions().isEmpty() || !plugin.getDependencies().isEmpty() ) ){ p.printStartBlock(); dependencies( plugin.getDependencies() );