public String getGroupId() { if ( mojoDescriptor != null ) { return mojoDescriptor.getPluginDescriptor().getGroupId(); } return plugin.getGroupId(); }
public void validate( PluginDescriptor pluginDescriptor ) { /* * NOTE: For plugins that depend on other plugin artifacts the plugin realm contains more than one plugin * descriptor. However, only the first descriptor is of interest. */ if ( !firstDescriptor ) { return; } firstDescriptor = false; if ( !pluginArtifact.getGroupId().equals( pluginDescriptor.getGroupId() ) ) { errors.add( "Plugin's descriptor contains the wrong group ID: " + pluginDescriptor.getGroupId() ); } if ( !pluginArtifact.getArtifactId().equals( pluginDescriptor.getArtifactId() ) ) { errors.add( "Plugin's descriptor contains the wrong artifact ID: " + pluginDescriptor.getArtifactId() ); } if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() ) ) { errors.add( "Plugin's descriptor contains the wrong version: " + pluginDescriptor.getVersion() ); } }
public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project, PlexusContainerException cause ) { super( message, cause ); this.project = project; PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); pluginGroupId = pd.getGroupId(); pluginArtifactId = pd.getArtifactId(); pluginVersion = pd.getVersion(); goal = mojoDescriptor.getGoal(); }
public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, NoSuchRealmException cause ) { super( message, cause ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, String message, Throwable cause ) { super( message, cause ); pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message ) { super( message ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, Throwable cause ) { super( message, cause ); this.project = project; pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId(); pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId(); pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion(); goal = mojoDescriptor.getGoal(); }
protected static PluginDescriptor clone( PluginDescriptor original ) { PluginDescriptor clone = null; if ( original != null ) { clone = new PluginDescriptor(); clone.setGroupId( original.getGroupId() ); clone.setArtifactId( original.getArtifactId() ); clone.setVersion( original.getVersion() ); clone.setGoalPrefix( original.getGoalPrefix() ); clone.setInheritedByDefault( original.isInheritedByDefault() ); clone.setName( original.getName() ); clone.setDescription( original.getDescription() ); clone.setRequiredMavenVersion( original.getRequiredMavenVersion() ); clone.setPluginArtifact( ArtifactUtils.copyArtifactSafe( original.getPluginArtifact() ) ); clone.setComponents( clone( original.getMojos(), clone ) ); clone.setId( original.getId() ); clone.setIsolatedRealm( original.isIsolatedRealm() ); clone.setSource( original.getSource() ); clone.setDependencies( original.getDependencies() ); } return clone; }
protected void setUp() throws Exception { assertTrue( "Maven 3.2.4 or better is required", MAVEN_VERSION == null || new DefaultArtifactVersion( "3.2.3" ).compareTo( MAVEN_VERSION ) < 0 ); configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); XmlStreamReader reader = new XmlStreamReader( is ); InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), pluginDescriptor.getVersion(), ".jar" ); artifact.setFile( getPluginArtifactFile() ); pluginDescriptor.setPluginArtifact( artifact ); pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() ) { getContainer().addComponentDescriptor( desc ); } mojoDescriptors = new HashMap<String, MojoDescriptor>(); for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) { mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); } }
private List<Artifact> getCheckstylePluginDependenciesAsArtifacts( Map<String, Plugin> plugins, String hint ) { List<Artifact> artifacts = new ArrayList<>(); Plugin checkstylePlugin = plugins.get( plugin.getGroupId() + ":" + plugin.getArtifactId() ); if ( checkstylePlugin != null ) { for ( Dependency dep : checkstylePlugin.getDependencies() ) { // @todo if we can filter on hints, it should be done here... String depKey = dep.getGroupId() + ":" + dep.getArtifactId(); artifacts.add( (Artifact) plugin.getArtifactMap().get( depKey ) ); } } return artifacts; }
/** * Returns conventional MojoExecution identifier used by incremental build tools. */ public String getExecutionId(MojoExecution execution) { PluginDescriptor pluginDescriptor = execution.getMojoDescriptor().getPluginDescriptor(); StringBuilder builderId = new StringBuilder(); builderId.append(pluginDescriptor.getGroupId()).append('_') .append(pluginDescriptor.getArtifactId()); builderId.append('_').append(execution.getGoal()).append('_') .append(execution.getExecutionId()); return builderId.toString(); }
private List<Artifact> getCheckstylePluginDependenciesAsArtifacts( Map<String, Plugin> plugins, String hint ) { List<Artifact> artifacts = new ArrayList<>(); Plugin checkstylePlugin = plugins.get( plugin.getGroupId() + ":" + plugin.getArtifactId() ); if ( checkstylePlugin != null ) { for ( Dependency dep : checkstylePlugin.getDependencies() ) { // @todo if we can filter on hints, it should be done here... String depKey = dep.getGroupId() + ":" + dep.getArtifactId(); artifacts.add( (Artifact) plugin.getArtifactMap().get( depKey ) ); } } return artifacts; }
public PluginName(PluginDescriptor pd) { this(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); }
public PluginName(PluginDescriptor pd) { this(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); }
private static File getArchive(AbstractWisdomMojo mojo, String profileOrGAV) throws MojoExecutionException { if (profileOrGAV == null || "regular".equalsIgnoreCase(profileOrGAV)) { return DependencyFinder.resolve(mojo, mojo.plugin.getGroupId(), Constants.WISDOM_RUNTIME_ARTIFACT_ID, mojo.plugin.getVersion(), "zip", null); } if ("base".equalsIgnoreCase(profileOrGAV)) { return DependencyFinder.resolve(mojo, mojo.plugin.getGroupId(), Constants.WISDOM_BASE_RUNTIME_ARTIFACT_ID, mojo.plugin.getVersion(), "zip", null); } if ("equinox".equalsIgnoreCase(profileOrGAV)) { return DependencyFinder.resolve(mojo, mojo.plugin.getGroupId(), Constants.WISDOM_RUNTIME_ARTIFACT_ID, mojo.plugin.getVersion(), "zip", "equinox"); } // It's a GAV. return DependencyFinder.resolve(mojo, profileOrGAV); }
protected boolean isExmlProject() { for(Object o : getProject().getBuildPlugins()) { Plugin plugin = (Plugin) o; if (plugin.getGroupId().equals(pluginDescriptor.getGroupId()) && plugin.getArtifactId().equals(pluginDescriptor.getArtifactId())) { return plugin.isExtensions(); } } return false; } }
protected boolean hasExmlConfiguration() { for (Object o : getProject().getBuildPlugins()) { Plugin plugin = (Plugin) o; if (plugin.getGroupId().equals(pluginDescriptor.getGroupId()) && plugin.getArtifactId().equals(pluginDescriptor.getArtifactId())) { return true; } } Build build = getProject().getOriginalModel().getBuild(); if (build != null) { PluginManagement pluginManagement = build.getPluginManagement(); if (pluginManagement != null) { for (Plugin plugin : pluginManagement.getPlugins()) { if (plugin.getGroupId().equals(pluginDescriptor.getGroupId()) && plugin.getArtifactId().equals(pluginDescriptor.getArtifactId())) { return true; } } } } return false; }
private File createWorkspace() throws MojoExecutionException { WorkspaceMojo.workspace = null; getLog().info(""); getLog().info(">>> " + pluginDescriptor.getArtifactId() + ":" + pluginDescriptor.getVersion() + ":workspace (" + "default-cli" + ") @ " + project.getArtifactId() + " >>>"); ArrayList<Element> configuration = new ArrayList<Element>(); executeMojo( plugin( groupId(pluginDescriptor.getGroupId()), artifactId(pluginDescriptor.getArtifactId()), version(pluginDescriptor.getVersion()) ), goal("workspace"), configuration( configuration.toArray(new Element[0]) ), getEnvironment() ); getLog().info(""); getLog().info("<<< " + pluginDescriptor.getArtifactId() + ":" + pluginDescriptor.getVersion() + ":workspace (" + "default-cli" + ") @ " + project.getArtifactId() + " <<<"); getLog().info(""); return WorkspaceMojo.workspace; }
private File getThisPluginAsDependency() { ComponentDependency dep = new ComponentDependency(); dep.setGroupId(plugin.getGroupId()); dep.setArtifactId(plugin.getArtifactId()); dep.setVersion(plugin.getVersion()); return getDependencyFile(dep); }
static AgentDependencies init(PluginDescriptor pluginDescriptor) throws MojoExecutionException { String pluginGroupId = pluginDescriptor.getGroupId(); String pluginArtifactId = pluginDescriptor.getArtifactId(); List<ExpectedDependency> expectedDependencies = Arrays.asList( new ExpectedDependency(pluginGroupId, "promagent-agent"), new ExpectedDependency(pluginGroupId, "promagent-internal"), new ExpectedDependency(pluginGroupId, "promagent-api"), new ExpectedDependency("io.prometheus", "simpleclient_common"), new ExpectedDependency("io.prometheus", "simpleclient"), new ExpectedDependency("net.bytebuddy", "byte-buddy"), new ExpectedDependency("commons-io", "commons-io") ); List<Artifact> actualDependencies = resolveVersions(pluginDescriptor, pluginArtifactId, expectedDependencies); failUnlessComplete(actualDependencies, expectedDependencies, pluginArtifactId); return new AgentDependencies(pluginGroupId, actualDependencies); }