本文整理汇总了Java中org.apache.maven.plugin.MojoExecution.getMojoDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java MojoExecution.getMojoDescriptor方法的具体用法?Java MojoExecution.getMojoDescriptor怎么用?Java MojoExecution.getMojoDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.plugin.MojoExecution
的用法示例。
在下文中一共展示了MojoExecution.getMojoDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NarTestCompileBuildParticipant
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental, boolean runOnConfiguration) {
super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()), runOnIncremental, runOnConfiguration);
// Some versions of nar-maven-plugin don't have a nar-test-unpack goal
// this means the test artifacts won't be available to us.
// What we need to do is run the nar-testCompile goal without any tests
// its configuration in order to just unpack.
Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
logger.debug("Configuration before: " + configuration);
for (int i = 0; i < configuration.getChildCount(); ++i) {
if ("tests".equals(configuration.getChild(i).getName())) {
configuration.removeChild(i);
break;
}
}
logger.debug("Configuration after: " + configuration);
getMojoExecution().setConfiguration(configuration);
}
示例2: setupMojoExecution
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( mojoDescriptor == null )
{
mojoDescriptor =
pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
project.getRemotePluginRepositories(),
session.getRepositorySession() );
mojoExecution.setMojoDescriptor( mojoDescriptor );
}
populateMojoExecutionConfiguration( project, mojoExecution,
MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );
finalizeMojoConfiguration( mojoExecution );
calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
}
示例3: debugDependencyRequirements
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void debugDependencyRequirements( List<MojoExecution> mojoExecutions )
{
Set<String> scopesToCollect = new TreeSet<String>();
Set<String> scopesToResolve = new TreeSet<String>();
for ( MojoExecution mojoExecution : mojoExecutions )
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
if ( StringUtils.isNotEmpty( scopeToCollect ) )
{
scopesToCollect.add( scopeToCollect );
}
String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
if ( StringUtils.isNotEmpty( scopeToResolve ) )
{
scopesToResolve.add( scopeToResolve );
}
}
logger.debug( "Dependencies (collect): " + scopesToCollect );
logger.debug( "Dependencies (resolve): " + scopesToResolve );
}
示例4: compile
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void compile(File basedir, File processor, String executionId) throws Exception {
MavenProject project = mojos.readMavenProject(basedir);
MavenSession session = mojos.newMavenSession(project);
MojoExecution execution = mojos.newMojoExecution();
MojoExecution cloned = new MojoExecution(execution.getMojoDescriptor(), executionId, null);
cloned.setConfiguration(execution.getConfiguration());
execution.getConfiguration().addChild(newParameter("proc", Proc.none.name()));
addDependency(project, "processor", new File(processor, "target/classes"));
mojos.executeMojo(session, project, cloned);
}
示例5: collectDependencyRequirements
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void collectDependencyRequirements( Set<String> scopesToResolve, Set<String> scopesToCollect,
Collection<MojoExecution> mojoExecutions )
{
for ( MojoExecution mojoExecution : mojoExecutions )
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
scopesToResolve.addAll( toScopes( mojoDescriptor.getDependencyResolutionRequired() ) );
scopesToCollect.addAll( toScopes( mojoDescriptor.getDependencyCollectionRequired() ) );
}
}
示例6: calculateForkedGoal
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private List<MojoExecution> calculateForkedGoal( MojoExecution mojoExecution, MavenSession session,
MavenProject project,
Collection<MojoDescriptor> alreadyForkedExecutions )
throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
String forkedGoal = mojoDescriptor.getExecuteGoal();
MojoDescriptor forkedMojoDescriptor = pluginDescriptor.getMojo( forkedGoal );
if ( forkedMojoDescriptor == null )
{
throw new MojoNotFoundException( forkedGoal, pluginDescriptor );
}
if ( alreadyForkedExecutions.contains( forkedMojoDescriptor ) )
{
return Collections.emptyList();
}
MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal );
populateMojoExecutionConfiguration( project, forkedExecution, true );
finalizeMojoConfiguration( forkedExecution );
calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions );
return Collections.singletonList( forkedExecution );
}
示例7: beforeProjectLifecycleExecution
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
@Override
public void beforeProjectLifecycleExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
final MavenProject project = event.getProject();
log.info("srcdeps enforcer checks for violations in {}:{}", project.getGroupId(), project.getArtifactId());
final Maven maven = configurationProducer.getConfiguration().getMaven();
final List<MojoExecution> mojoExecutions = event.getExecutionPlan();
final List<String> goals = new ArrayList<>(mojoExecutions.size());
for (MojoExecution mojoExecution : mojoExecutions) {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
goals.add(mojoDescriptor.getFullGoalName());
goals.add(mojoDescriptor.getGoal());
}
final List<String> profiles = new ArrayList<>();
final List<Profile> activeProfiles = project.getActiveProfiles();
for (Profile profile : activeProfiles) {
final String id = profile.getId();
profiles.add(id);
}
final Properties props = new Properties();
props.putAll(project.getProperties());
props.putAll(System.getProperties());
String[] firstViolation = assertFailWithout(maven.getFailWithout(), goals, profiles, props);
if (firstViolation == null) {
firstViolation = assertFailWith(maven.getFailWith(), goals, profiles, props);
}
if (firstViolation != null) {
/* check if there are srcdeps */
Artifact parent = project.getParentArtifact();
if (parent != null) {
assertNotSrcdeps(parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), firstViolation);
}
DependencyManagement dm;
List<Dependency> deps;
if ((dm = project.getDependencyManagement()) != null && (deps = dm.getDependencies()) != null) {
assertNotSrcdeps(deps, firstViolation);
}
if ((deps = project.getDependencies()) != null) {
assertNotSrcdeps(deps, firstViolation);
}
}
}
示例8: calculateForkedExecutions
import org.apache.maven.plugin.MojoExecution; //导入方法依赖的package包/类
private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project,
Collection<MojoDescriptor> alreadyForkedExecutions )
throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( !mojoDescriptor.isForking() )
{
return;
}
if ( !alreadyForkedExecutions.add( mojoDescriptor ) )
{
return;
}
List<MavenProject> forkedProjects =
LifecycleDependencyResolver.getProjects( project, session, mojoDescriptor.isAggregator() );
for ( MavenProject forkedProject : forkedProjects )
{
if ( forkedProject != project )
{
lifecyclePluginResolver.resolveMissingPluginVersions( forkedProject, session );
}
List<MojoExecution> forkedExecutions;
if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
{
forkedExecutions =
calculateForkedLifecycle( mojoExecution, session, forkedProject, alreadyForkedExecutions );
}
else
{
forkedExecutions =
calculateForkedGoal( mojoExecution, session, forkedProject, alreadyForkedExecutions );
}
mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions );
}
alreadyForkedExecutions.remove( mojoDescriptor );
}