I figured out how to generate an archetype programmatically (see code below).
Now I'm trying to execute goals w/in that project using MavenEmbedder. It
seems to *almost* works, except that a plugin with
"<extensions>true</extensions>" is failing. Does the MavenEmbedder not
support plugins with extensions?



    protected void createTestProject(String archetypeArtifactId, String
archetypeVersion) throws Exception {
        MavenProject project = getMavenProject();
        FileUtils.deleteDirectory(getTestFile("target/" +

        Map<String, String> parameters = new HashMap<String, String>();

        parameters.put("groupId", project.getGroupId());
        parameters.put("artifactId", project.getArtifactId());
        parameters.put("version", "1.0-SNAPSHOT");
        parameters.put("basedir", getTestFile("target").getAbsolutePath());

        Archetype archetype = (Archetype) lookup(Archetype.ROLE);

        ArtifactRepositoryLayout layout =
container.lookup(ArtifactRepositoryLayout.ROLE, "default");

        String mavenRepoLocal = project.getRepositories().get(0).toString();

        ArtifactRepository localRepository = new
DefaultArtifactRepository("local", mavenRepoLocal, layout);

        List<ArtifactRepository> remoteRepositories = new
        String mavenRepoRemote = "http://static.appfuse.org/repository";;
        ArtifactRepository remoteRepository = new
DefaultArtifactRepository("remote", mavenRepoRemote, layout);


        String archetypeGroupId = "org.appfuse";
        archetype.createArchetype(archetypeGroupId, archetypeArtifactId,
archetypeVersion, localRepository,
                remoteRepositories, parameters);

mraible wrote:
> Does anyone have a Maven Embedder example that runs archetype:create?  I'd
> like to create an archetype, run a plugin and verify that files are
> created in the new project.  I could run the archetype creation and plugin
> with Ant, but that doesn't seem to be a very good way to test the code
> generation plugin I'm writing.
> Thanks,
> Matt

View this message in context: 
Sent from the Maven - Users mailing list archive at Nabble.com.

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to