/** * Gets the identifier of the plugin. * * @return The plugin id in the form {@code <groupId>:<artifactId>:<version>}, never {@code null}. */ public String getId() { StringBuilder id = new StringBuilder( 128 ); id.append( ( getGroupId() == null ) ? "[unknown-group-id]" : getGroupId() ); id.append( ":" ); id.append( ( getArtifactId() == null ) ? "[unknown-artifact-id]" : getArtifactId() ); id.append( ":" ); id.append( ( getVersion() == null ) ? "[unknown-version]" : getVersion() ); return id.toString(); }
protected void mergePlugin_Version( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getVersion(); if ( src != null ) { if ( sourceDominant || target.getVersion() == null ) { target.setVersion( src ); target.setLocation( "version", source.getLocation( "version" ) ); } } }
public PluginNotFoundException( Plugin plugin, List<ArtifactRepository> remoteRepositories ) { super( "Plugin could not be found, please check its coordinates for typos and ensure the required" + " plugin repositories are defined in the POM", plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), "maven-plugin", null, remoteRepositories, null ); this.plugin = plugin; }
protected PluginManagerException( Plugin plugin, String message, MavenProject project, Throwable cause ) { super( message, cause ); this.project = project; pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
public PluginManagerException( Plugin plugin, String message, Throwable cause ) { super( message, cause ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
public PluginManagerException( Plugin plugin, String message, MavenProject project ) { super( message ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); this.project = project; }
public PluginManagerException( Plugin plugin, InvalidVersionSpecificationException cause ) { super( cause ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
public PluginManagerException( Plugin plugin, String message, ComponentRepositoryException cause ) { super( message, cause ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
public PluginManagerException( Plugin plugin, String message, PlexusContainerException cause ) { super( message, cause ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
public String getVersion() { if ( mojoDescriptor != null ) { return mojoDescriptor.getPluginDescriptor().getVersion(); } return plugin.getVersion(); }
public PluginManagerException( Plugin plugin, String message, PlexusConfigurationException cause ) { super( message, cause ); pluginGroupId = plugin.getGroupId(); pluginArtifactId = plugin.getArtifactId(); pluginVersion = plugin.getVersion(); }
private PluginVersionResult resolveFromProject( PluginVersionRequest request, List<Plugin> plugins ) { for ( Plugin plugin : plugins ) { if ( request.getGroupId().equals( plugin.getGroupId() ) && request.getArtifactId().equals( plugin.getArtifactId() ) ) { if ( plugin.getVersion() != null ) { return new DefaultPluginVersionResult( plugin.getVersion() ); } else { return null; } } } return null; }
private static String getKey( Plugin plugin, boolean extension ) { String version = ArtifactUtils.toSnapshotVersion( plugin.getVersion() ); return ( extension ? "extension>" : "plugin>" ) + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + version; }
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 PluginArtifact( Plugin plugin, Artifact pluginArtifact ) { super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null, new PluginArtifactHandler() ); this.plugin = plugin; setFile( pluginArtifact.getFile() ); setResolved( true ); }
public Artifact createPluginArtifact( Plugin plugin ) { VersionRange versionRange; try { String version = plugin.getVersion(); if ( StringUtils.isEmpty( version ) ) { version = "RELEASE"; } versionRange = VersionRange.createFromVersionSpec( version ); } catch ( InvalidVersionSpecificationException e ) { return null; } return createPluginArtifactX( plugin.getGroupId(), plugin.getArtifactId(), versionRange ); }
public Artifact createPluginArtifact( Plugin plugin ) { String version = plugin.getVersion(); if ( StringUtils.isEmpty( version ) ) { version = "RELEASE"; } VersionRange versionRange; try { versionRange = VersionRange.createFromVersionSpec( version ); } catch ( InvalidVersionSpecificationException e ) { // MNG-5368: Log a message instead of returning 'null' silently. this.logger.error( String.format( "Invalid version specification '%s' creating plugin artifact '%s'.", version, plugin ), e ); return null; } return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange ); }
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() ) ); } }
private Artifact toArtifact( Plugin plugin, RepositorySystemSession session ) { return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), null, "jar", plugin.getVersion(), session.getArtifactTypeRegistry().get( "maven-plugin" ) ); }
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; }