Search in sources :

Example 6 with MavenRunnerParameters

use of org.jetbrains.idea.maven.execution.MavenRunnerParameters in project intellij-community by JetBrains.

the class ArchetypesTest method testGenerating.

public void testGenerating() throws Exception {
    if (!hasMavenInstallation())
        return;
    File dir = new File(myDir.getPath(), "generated");
    dir.mkdirs();
    MavenRunnerParameters params = new MavenRunnerParameters(false, dir.getPath(), Arrays.asList("org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate"), Collections.<String>emptyList());
    MavenRunnerSettings settings = new MavenRunnerSettings();
    Map<String, String> props = new THashMap<>();
    props.put("archetypeGroupId", "org.apache.maven.archetypes");
    props.put("archetypeArtifactId", "maven-archetype-quickstart");
    props.put("archetypeVersion", "1.0");
    props.put("interactiveMode", "false");
    props.put("groupId", "foo");
    props.put("groupId", "foo");
    props.put("artifactId", "bar");
    settings.setMavenProperties(props);
    MavenExecutor exec;
    settings.setJreName(MavenRunnerSettings.USE_INTERNAL_JAVA);
    exec = new MavenExternalExecutor(myProject, params, getMavenGeneralSettings(), settings, NULL_MAVEN_CONSOLE);
    exec.execute(new EmptyProgressIndicator());
    assertTrue(new File(dir, "bar/pom.xml").exists());
}
Also used : MavenRunnerSettings(org.jetbrains.idea.maven.execution.MavenRunnerSettings) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) THashMap(gnu.trove.THashMap) MavenExecutor(org.jetbrains.idea.maven.execution.MavenExecutor) File(java.io.File) MavenExternalExecutor(org.jetbrains.idea.maven.execution.MavenExternalExecutor) MavenRunnerParameters(org.jetbrains.idea.maven.execution.MavenRunnerParameters)

Aggregations

MavenRunnerParameters (org.jetbrains.idea.maven.execution.MavenRunnerParameters)6 MavenExplicitProfiles (org.jetbrains.idea.maven.model.MavenExplicitProfiles)3 Project (com.intellij.openapi.project.Project)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 MavenRunner (org.jetbrains.idea.maven.execution.MavenRunner)2 MavenRunnerSettings (org.jetbrains.idea.maven.execution.MavenRunnerSettings)2 MavenProject (org.jetbrains.idea.maven.project.MavenProject)2 MavenProjectsManager (org.jetbrains.idea.maven.project.MavenProjectsManager)2 ExecutionException (com.intellij.execution.ExecutionException)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 JavaParameters (com.intellij.execution.configurations.JavaParameters)1 CompilerMessageCategory (com.intellij.openapi.compiler.CompilerMessageCategory)1 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 PsiFile (com.intellij.psi.PsiFile)1 Semaphore (com.intellij.util.concurrency.Semaphore)1 HashMap (com.intellij.util.containers.HashMap)1 THashMap (gnu.trove.THashMap)1