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


Java MavenPlugin类代码示例

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


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

示例1: getPhaseVariants

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
public static List<LookupElement> getPhaseVariants(MavenProjectsManager manager) {
  Set<String> goals = new HashSet<String>();
  goals.addAll(MavenConstants.PHASES);

  for (MavenProject mavenProject : manager.getProjects()) {
    for (MavenPlugin plugin : mavenProject.getPlugins()) {
      MavenPluginInfo pluginInfo = MavenArtifactUtil.readPluginInfo(manager.getLocalRepository(), plugin.getMavenId());
      if (pluginInfo != null) {
        for (MavenPluginInfo.Mojo mojo : pluginInfo.getMojos()) {
          goals.add(mojo.getDisplayName());
        }
      }
    }
  }

  List<LookupElement> res = new ArrayList<LookupElement>(goals.size());
  for (String goal : goals) {
    res.add(LookupElementBuilder.create(goal).withIcon(MavenIcons.Phase));
  }

  return res;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MavenUtil.java

示例2: patch

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
public static void patch(Properties modelProperties, @Nullable Collection<MavenPlugin> plugins) {
  if (plugins == null) return;

  Map<String, Map<String, Map<String, List<MavenPluginDescriptor>>>> map = MavenPluginDescriptor.getDescriptorsMap();

  for (MavenPlugin plugin : plugins) {
    Map<String, Map<String, List<MavenPluginDescriptor>>> groupMap = map.get(plugin.getArtifactId());
    if (groupMap != null) {
      Map<String, List<MavenPluginDescriptor>> goalsMap = groupMap.get(plugin.getGroupId());
      if (goalsMap != null) {
        patch(modelProperties, goalsMap.get(null), null, plugin.getConfigurationElement(), plugin);

        for (MavenPlugin.Execution execution : plugin.getExecutions()) {
          for (String goal : execution.getGoals()) {
            patch(modelProperties, goalsMap.get(goal), goal, execution.getConfigurationElement(), plugin);
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MavenModelPropertiesPatcher.java

示例3: generate

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Override
public void generate(@NotNull Properties modelProperties,
                     @Nullable String goal,
                     @NotNull MavenPlugin plugin,
                     @Nullable Element cfgElement) {
  if (cfgElement == null) return;

  Element portNames = cfgElement.getChild("portNames");
  if (portNames == null) return;

  List<Element> portName = portNames.getChildren("portName");
  for (Element element : portName) {
    String propertyName = element.getTextTrim();
    if (!propertyName.isEmpty()) {
      modelProperties.setProperty(propertyName, "");
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenBuildHelperPropertyGenerator.java

示例4: buildActions

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Override
protected void buildActions(DefaultActionGroup toGroup, MavenProject mavenProject) {
    Map<MavenPlugin, AnAction[]> pluginActions = buildAllPlugins(mavenProject);

    List<AnAction> defaultPluginGroups = new ArrayList<AnAction>();
    List<AnAction> customPluginGroups = new ArrayList<AnAction>();
    for (Map.Entry<MavenPlugin, AnAction[]> plgActions : pluginActions.entrySet()) {
        String name = plgActions.getKey().getArtifactId();
        AnAction popupGroup = addPopupGroup(name, plgActions.getValue());
        if (defaultPlugins.contains(name))
            defaultPluginGroups.add(popupGroup);
        else
            customPluginGroups.add(popupGroup);
    }
    if (!defaultPluginGroups.isEmpty())
        addActionGroup(toGroup, "Default Plugins", defaultPluginGroups);
    if (!customPluginGroups.isEmpty())
        addActionGroup(toGroup, "Custom Plugins", customPluginGroups);
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:20,代码来源:MvnPluginGoalSwitchAction.java

示例5: buildAllPlugins

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
private Map<MavenPlugin, AnAction[]> buildAllPlugins(MavenProject mavenProject) {
    File localRepository = mavenProject.getLocalRepository();
    MvnRunConfigurationSettings settings = MvnRunConfigurationSettings.getInstance();
    boolean withPrefix = settings.isWithPrefix();
    boolean ignoreDefault = settings.isIgnoreCorePlugin();

    Map<MavenPlugin, AnAction[]> pluginActions = new TreeMap<MavenPlugin, AnAction[]>(new MavenPluginComparator());
    for (MavenPlugin plugin : mavenProject.getDeclaredPlugins()) {
        loadPluginInfo(localRepository, plugin.getMavenId());
        if (ignoreDefault && skipPlugin(plugin.getMavenId()))
            continue;

        AnAction[] actions = buildPluginActions(plugin.getMavenId(), withPrefix);
        if (actions.length > 0) {
            pluginActions.put(plugin, actions);
        }
    }
    return pluginActions;
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:20,代码来源:MvnPluginGoalSwitchAction.java

示例6: patch

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
public static void patch(Properties modelProperties, @Nullable Collection<MavenPlugin> plugins) {
  if (plugins == null) return;

  Map<String, Map<String, String[]>> map = getMap();

  for (MavenPlugin plugin : plugins) {
    Map<String, String[]> groupMap = map.get(plugin.getArtifactId());
    if (groupMap != null) {
      String[] properties = groupMap.get(plugin.getGroupId());

      if (properties != null) {
        for (String property : properties) {
          if (!modelProperties.containsKey(property)) {
            modelProperties.setProperty(property, "");
          }
        }
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:MavenModelPropertiesPatcher.java

示例7: findManifestLocation

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
private String findManifestLocation(MavenProject mavenProject) {
  String manifestLocation = null;

  // Try ijplugin-maven-plugin configuration
  MavenPlugin plugin =
          mavenProject.findPlugin(myPluginGroupID, myPluginArtifactID);
  if (plugin != null) {
    Element config = plugin.getConfigurationElement();
    if (config != null) {
      Element child = config.getChild(MANIFEST_LOCATION_PARAMETER);
      manifestLocation = child.getText();
    }
  }

  // Try ij.pluginDescriptor
  if (manifestLocation == null) {
    manifestLocation = mavenProject.getProperties().getProperty(IJPLUGIN_DESCRIPTOR_PROPERTY);
  }

  if (manifestLocation == null) {
    // Default location
    manifestLocation = "META-INF/plugin.xml";
  }
  return manifestLocation;
}
 
开发者ID:Guidewire,项目名称:devkit-maven-support,代码行数:26,代码来源:PluginModuleImporter.java

示例8: getGoals

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
protected List<String> getGoals(AnActionEvent e, PsiJavaFile psiFile, MavenProject mavenProject) {
	List<String> goals = new ArrayList<String>();
	boolean skipTests = isSkipTests(mavenProject);
	// so many possibilities...
	if (skipTests || isExcludedFromSurefire(psiFile, mavenProject)) {
		MavenPlugin failsafePlugin = mavenProject.findPlugin("org.apache.maven.plugins", "maven-failsafe-plugin");
		if (failsafePlugin != null) {
               addFailSafeParameters(e, psiFile, goals, failsafePlugin);
           } else {
               addSurefireParameters(e, psiFile, goals);
           }
		goals.add("verify");
	} else {
		addSurefireParameters(e, psiFile, goals);
		goals.add("test-compile");
		goals.add("surefire:test");
	}

	return goals;
}
 
开发者ID:krasa,项目名称:MavenHelper,代码行数:21,代码来源:RunTestFileAction.java

示例9: getVersion

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Nullable
private String getVersion(MavenProject project) {
  for (MavenArtifact artifact : project.findDependencies("com.google.appengine", "appengine-api-1.0-sdk")) {
    String artifactVersion = artifact.getVersion();
    if (artifactVersion != null) return artifactVersion;
  }
  MavenPlugin plugin = project.findPlugin(myPluginGroupID, myPluginArtifactID);
  return plugin != null ? plugin.getVersion() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AppEngineFacetImporter.java

示例10: collectGoals

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
private static List<String> collectGoals(MavenProject project) {
  LinkedHashSet<String> result = new LinkedHashSet<String>(); // may contains similar plugins or somethig
  result.addAll(MavenConstants.PHASES);

  for (MavenPlugin each : project.getDeclaredPlugins()) {
    collectGoals(project.getLocalRepository(), each, result);
  }

  return new ArrayList<String>(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MavenKeymapExtension.java

示例11: resolve

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Override
public PsiFile resolve(MavenId id, ConvertContext context) {
  PsiFile res = super.resolve(id, context);
  if (res != null) return res;

  // Try to resolve to imported plugin
  MavenProject mavenProject = findMavenProject(context);
  if (mavenProject != null) {
    for (MavenPlugin plugin : mavenProject.getPlugins()) {
      if (MavenArtifactUtil.isPluginIdEquals(id.getGroupId(), id.getArtifactId(), plugin.getGroupId(), plugin.getArtifactId())) {
        return super.resolve(plugin.getMavenId(), context);
      }
    }
  }

  // Try to resolve to plugin with latest version
  PsiManager psiManager = context.getPsiManager();
  MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(psiManager.getProject());

  File artifactFile = MavenArtifactUtil
    .getArtifactFile(projectsManager.getLocalRepository(), id.getGroupId(), id.getArtifactId(), id.getVersion(), "pom");

  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(artifactFile);
  if (virtualFile != null) {
    return psiManager.findFile(virtualFile);
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MavenArtifactCoordinatesConverter.java

示例12: isApplicable

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Override
public boolean isApplicable(MavenProject mavenProject) {
 MavenPlugin compilerPlugin = mavenProject.findPlugin("org.apache.maven.plugins", "maven-compiler-plugin");
 if (compilerPlugin == null) return false;

 for(MavenId id : compilerPlugin.getDependencies()) {
   if ("groovy-eclipse-compiler".equals(id.getArtifactId()) && "org.codehaus.groovy".equals(id.getGroupId())) {
     return true;
   }
 }

 return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GroovyEclipseCompilerImporter.java

示例13: p

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
private List<PluginInfo> p(Collection<MavenPlugin> mavenPlugins) {
  List<PluginInfo> res = new ArrayList<PluginInfo>(mavenPlugins.size());
  for (MavenPlugin mavenPlugin : mavenPlugins) {
    res.add(p(mavenPlugin));
  }

  return res;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MavenProjectTest.java

示例14: getVersion

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Nullable
private String getVersion(MavenProject project) {
  for (MavenArtifact artifact :
      project.findDependencies("com.google.appengine", "appengine-api-1.0-sdk")) {
    String artifactVersion = artifact.getVersion();
    if (artifactVersion != null) {
      return artifactVersion;
    }
  }
  MavenPlugin plugin = project.findPlugin(myPluginGroupID, myPluginArtifactID);
  return plugin != null ? plugin.getVersion() : null;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:13,代码来源:AppEngineFacetImporter.java

示例15: compare

import org.jetbrains.idea.maven.model.MavenPlugin; //导入依赖的package包/类
@Override
public int compare(MavenPlugin o1, MavenPlugin o2) {
    if (defaultPlugins.contains(o1.getArtifactId()) && !defaultPlugins.contains(o2.getArtifactId()))
        return -1;
    if (!defaultPlugins.contains(o1.getArtifactId()) && defaultPlugins.contains(o2.getArtifactId()))
        return 1;
    return o1.getArtifactId().compareTo(o2.getArtifactId());
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:9,代码来源:MvnPluginGoalSwitchAction.java


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