maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steffen Stundzig <>
Subject Fwd: maven3 embedder
Date Tue, 10 Aug 2010 16:38:12 GMT
Hi folks,

sorry for the spam. I'm also posted on users. Whats the correct list for
such plugin developer questions?


I've tried the whole day on how can i embedd a call for a maven goal
into my java src. I'm working with maven-3.0-beta-1.

Here are my sample snippets which the appropriate error messages:

public class MavenEmbedTest {
  public static void main(String[] args) {
    File workingDir = new File("/path/to/a/maven/project");

    // [1]
    MavenCli cli = new MavenCli();
    cli.doMain(new String[] { "package" }, workingDir.getAbsolutePath(),
        System.out, System.err);

    // [2]	
    DefaultMaven maven = new DefaultMaven();
    DefaultMavenExecutionRequest request = new
    List<String> goals = new ArrayList<String>();
    MavenExecutionResult result = maven.execute(request);

    // [3]
    File pom = new File(workingDir, "pom.xml");
    DefaultProjectBuilder projectBuilder = new DefaultProjectBuilder();
    ProjectBuildingResult project =, new

As result of [1] running as local java program, i got:
[ERROR] Error executing Maven.
[ERROR] Cycle detected in component graph in the system:
[ERROR] Caused by: Cyclic requirement detected
[ERROR] Caused by: Edge between
introduces to cycle in the graph
org.apache.maven.project.MavenProjectBuilder:default -->
org.apache.maven.project.ProjectBuilder:default -->
org.apache.maven.model.building.ModelBuilder:default -->
org.apache.maven.model.plugin.LifecycleBindingsInjector:default -->
org.apache.maven.lifecycle.LifecycleExecutor:default -->

As result of [2] I got a NullPointerException, because of the annotated
components were not injected. How can I start the PlexusContainer correctly?

The result of [3] is "RepositorySystem is missing" which is nearly the
same problem as in [2].

What I need is to start a maven plugin, which is deployed in my local
repo and is based on maven3.

Could anybody help my please? Are there any samples or code snippets,
which I could use?

Currently I'm working on a hudson build trigger for maven3 based free
style projects. The trigger checks updates on the maven dependencies and
the schedules a rebuild.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message