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


Java Mojo类代码示例

本文整理汇总了Java中org.apache.maven.plugins.annotations.Mojo的典型用法代码示例。如果您正苦于以下问题:Java Mojo类的具体用法?Java Mojo怎么用?Java Mojo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mojo类属于org.apache.maven.plugins.annotations包,在下文中一共展示了Mojo类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSupportedAnnotationTypes

import org.apache.maven.plugins.annotations.Mojo; //导入依赖的package包/类
@Override
public Set<String> getSupportedAnnotationTypes() {
  Set<String> types = new HashSet<>();
  types.add(Mojo.class.getName());
  types.add(Parameter.class.getName());
  types.add(Component.class.getName());
  return types;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:9,代码来源:MojoDescriptorGleaner.java

示例2: processType

import org.apache.maven.plugins.annotations.Mojo; //导入依赖的package包/类
MojoDescriptor processType(TypeElement type) {
  MojoDescriptor descriptor = new MojoDescriptor();

  descriptor.setImplementation(type.getQualifiedName().toString());
  descriptor.setSuperclasses(getSuperclasses(type, new ArrayList<String>()));

  Mojo mojo = type.getAnnotation(Mojo.class);
  if (mojo != null) {
    // mojo is null for classes that have @Parameter/@Component element annotations

    descriptor.setLanguage("java");
    descriptor.setGoal(mojo.name());
    descriptor.setExecutionStrategy(mojo.executionStrategy());
    descriptor.setRequiresProject(mojo.requiresProject());
    descriptor.setRequiresReports(mojo.requiresReports());
    descriptor.setAggregator(mojo.aggregator());
    descriptor.setRequiresDirectInvocation(mojo.requiresDirectInvocation());
    descriptor.setRequiresOnline(mojo.requiresOnline());
    descriptor.setInheritedByDefault(mojo.inheritByDefault());
    if (!isEmpty(mojo.configurator())) {
      descriptor.setConfigurator(mojo.configurator());
    }
    descriptor.setThreadSafe(mojo.threadSafe());
    descriptor.setPhase(mojo.defaultPhase().id());
    descriptor.setRequiresDependencyResolution(mojo.requiresDependencyResolution().id());
    descriptor.setRequiresDependencyCollection(mojo.requiresDependencyCollection().id());
    descriptor.setInstantiationStrategy(mojo.instantiationStrategy().id());

    if (getElementUtils().isDeprecated(type)) {
      descriptor.setDeprecated("No reason given"); // TODO parse javadoc
    }
    // This is not ideal
    // the proper way would be to add support for processorPath to compiler plugin
    // which would allow us to do this as part of takari-builder annotation processing
    // without adding takari-builder-apt to the compile classpath
    // we intend to do this properly... soon
    if (isTakariBuilderMojo(type)) {
      descriptor.setTakariBuilder(true);
    }
    descriptor.setDescription(getDescription(type));
  }

  processTypeFields(type, descriptor);

  Sorting.sortParameters(descriptor.getParameters());
  Sorting.sortRequirements(descriptor.getRequirements());

  return descriptor;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:50,代码来源:MojoDescriptorGleaner.java

示例3: getAnnotatedTypes

import org.apache.maven.plugins.annotations.Mojo; //导入依赖的package包/类
private Set<TypeElement> getAnnotatedTypes(RoundEnvironment roundEnv) {
  Set<TypeElement> types = new HashSet<>();
  roundEnv.getElementsAnnotatedWith(Mojo.class).forEach(type -> types.add((TypeElement) type));
  addAnnotatedMembers(types, roundEnv, Parameter.class);
  addAnnotatedMembers(types, roundEnv, Component.class);
  return types;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:8,代码来源:MojoDescriptorGleaner.java


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