private void configDependencies() {
    for (MavenArtifact artifact : myMavenProject.getDependencies()) {
      if (!myMavenProject.isSupportedDependency(artifact, SupportedRequestType.FOR_IMPORT))
        continue;

      DependencyScope scope = selectScope(artifact.getScope());
      MavenProject depProject = myMavenTree.findProject(artifact.getMavenId());

      if (depProject != null) {
        if (depProject == myMavenProject) continue;
        boolean isTestJar =
            MavenConstants.TYPE_TEST_JAR.equals(artifact.getType())
                || "tests".equals(artifact.getClassifier());
        myRootModelAdapter.addModuleDependency(
            myMavenProjectToModuleName.get(depProject), scope, isTestJar);

        Element buildHelperCfg =
            depProject.getPluginGoalConfiguration(
                "org.codehaus.mojo", "build-helper-maven-plugin", "attach-artifact");
        if (buildHelperCfg != null) {
          addAttachArtifactDependency(buildHelperCfg, scope, depProject, artifact);
        }
      } else {
        myRootModelAdapter.addLibraryDependency(
            artifact, scope, myModifiableModelsProvider, myMavenProject);
      }
    }

    configSurefirePlugin();
  }
Beispiel #2
0
  private void doImportProjects(final List<VirtualFile> files, String... profiles) {
    initProjectsManager(false);

    readProjects(files, profiles);

    UIUtil.invokeAndWaitIfNeeded(
        new Runnable() {
          @Override
          public void run() {
            myProjectsManager.waitForResolvingCompletion();
            myProjectsManager.scheduleImportInTests(files);
            myProjectsManager.importProjects();
          }
        });

    for (MavenProject each : myProjectsTree.getProjects()) {
      if (each.hasReadingProblems()) {
        System.out.println(each + " has problems: " + each.getProblems());
      }
    }
  }