當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。