当前位置: 首页>>代码示例>>Java>>正文


Java MojoDescriptor.getGoal方法代码示例

本文整理汇总了Java中org.apache.maven.plugin.descriptor.MojoDescriptor.getGoal方法的典型用法代码示例。如果您正苦于以下问题:Java MojoDescriptor.getGoal方法的具体用法?Java MojoDescriptor.getGoal怎么用?Java MojoDescriptor.getGoal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.plugin.descriptor.MojoDescriptor的用法示例。


在下文中一共展示了MojoDescriptor.getGoal方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
  artifactResolver = new PredefinedRepoArtifactResolver(repoSystem, repoSession,
      project.getRemoteProjectRepositories(), getLog());

  MojoDescriptor mojoDescriptor = mojo.getMojoDescriptor();
  String goalName = mojoDescriptor.getGoal();

  long eventId = GoogleAnalyticsTrackingService.DEFAULT_EVENT_ID;

  String pluginVersion = this.getClass().getPackage().getImplementationVersion();
  GoogleAnalyticsTrackingService googleAnalyticsTrackingService =
      new GoogleAnalyticsTrackingServiceImpl(analyticsWaitingTimeInMs, skipAnalytics(),
          pluginVersion, getLog());

  try {
    eventId = googleAnalyticsTrackingService.sendEvent(analyticsReferer, goalName);
    doExecute();
  } finally {
    googleAnalyticsTrackingService.waitForEventSending(eventId);
  }
}
 
开发者ID:everit-org,项目名称:eosgi-maven-plugin,代码行数:23,代码来源:AbstractEOSGiMojo.java

示例2: getText

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
@Override
public String getText(Object element) {
    if (element instanceof Profile) {
        return ((Profile) element).getName();
    }
    if (element instanceof Plugin) {
        return ((Plugin) element).getKey();
    }
    if (element instanceof ProjectLabel) {
        return ((ProjectLabel) element).label;
    }
    if (element instanceof MojoDescriptor) {
        MojoDescriptor mojo = ((MojoDescriptor) element);
        return mojo.getPluginDescriptor().getGoalPrefix() + ":" + mojo.getGoal();
    }
    return element.toString();
}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:18,代码来源:ConfigLabelProvider.java

示例3: getGoalName

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
private String getGoalName() {
  PluginDescriptor pluginDescriptor = getPluginDescriptor();
  for (MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos()) {
    if (mojoDescriptor.getImplementation().equals(getClass().getName())) {
      return mojoDescriptor.getGoal();
    }
  }
  return null;
}
 
开发者ID:shillner,项目名称:maven-cdi-plugin-utils,代码行数:10,代码来源:AbstractCDIMojo.java

示例4: determineGoal

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
String determineGoal(String className, PluginDescriptor pluginDescriptor) throws ComponentConfigurationException {
  List<MojoDescriptor> mojos = pluginDescriptor.getMojos();
  for (MojoDescriptor mojo : mojos) {
    if (className.equals(mojo.getImplementation())) {
      return mojo.getGoal();
    }
  }
  throw new ComponentConfigurationException("Cannot find the goal implementation with " + className);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:10,代码来源:MojoConfigurationProcessor.java

示例5: PluginManagerException

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
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();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:PluginManagerException.java

示例6: execute

import org.apache.maven.plugin.descriptor.MojoDescriptor; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {

    this.pluginDescriptor = ((PluginDescriptor) getPluginContext().get("pluginDescriptor"));

    tempDirectory.mkdirs();
    outputDirectory.mkdirs();

    try {
        // build the full pom
        Configuration cfg = new Configuration(Configuration.VERSION_2_3_21);

        // Specify the data source where the template files come from. Here I set a
        // plain directory for it, but non-file-system are possible too:
        cfg.setDirectoryForTemplateLoading(tempDirectory);

        // Specify how templates will see the data-model. This is an advanced topic...
        // for now just use this:
        BeansWrapperBuilder wrapperBuilder = new BeansWrapperBuilder(Configuration.VERSION_2_3_21);
        wrapperBuilder.setStrict(false);
        cfg.setObjectWrapper(wrapperBuilder.build());

        // Set your preferred charset template files are stored in. UTF-8 is
        // a good choice in most applications:
        cfg.setDefaultEncoding("UTF-8");

        // Sets how errors will appear. Here we assume we are developing HTML pages.
        // For production systems TemplateExceptionHandler.RETHROW_HANDLER is better.
        cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);

        // At least in new projects, specify that you want the fixes that aren't
        // 100% backward compatible too (these are very low-risk changes as far as the
        // 1st and 2nd version number remains):
        cfg.setIncompatibleImprovements(Configuration.VERSION_2_3_21);  // FreeMarker 2.3.20

        // copy the template from jar freemaker can't read stream
        getLog().debug("get the template localy.");
        String ftlName = "mojo-doc.ftl";
        try (
                InputStream input = getClass().getClassLoader().getResourceAsStream("documentation/" + ftlName);
                FileOutputStream outputStream = new FileOutputStream(new File(this.tempDirectory, ftlName))
        ) {
            IOUtils.copy(input, outputStream);
            outputStream.flush();
        }

        getLog().debug("Parse the  ftl.");
        Template temp = cfg.getTemplate(ftlName);

        for (MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos()) {
            getLog().info("Build documentation into " + this.outputDirectory.getAbsolutePath() + "/" + mojoDescriptor.getGoal() + ".html");
            File pom = new File(this.outputDirectory, mojoDescriptor.getGoal() + ".html");
            try (Writer out = new FileWriter(pom)) {
                temp.process(mojoDescriptor, out);
                out.flush();
            }
        }

    } catch (IOException | TemplateException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }


}
 
开发者ID:famaridon,项目名称:vdoc-maven-plugin,代码行数:65,代码来源:GeneratePluginDocMojo.java


注:本文中的org.apache.maven.plugin.descriptor.MojoDescriptor.getGoal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。