Search in sources :

Example 1 with MavenExternalExecutor

use of org.jetbrains.idea.maven.execution.MavenExternalExecutor 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

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 THashMap (gnu.trove.THashMap)1 File (java.io.File)1 MavenExecutor (org.jetbrains.idea.maven.execution.MavenExecutor)1 MavenExternalExecutor (org.jetbrains.idea.maven.execution.MavenExternalExecutor)1 MavenRunnerParameters (org.jetbrains.idea.maven.execution.MavenRunnerParameters)1 MavenRunnerSettings (org.jetbrains.idea.maven.execution.MavenRunnerSettings)1