maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Kutzinski" <>
Subject Using MavenEmbedder to read a project definition
Date Wed, 03 Feb 2010 14:05:19 GMT

I'm currently trying to use MavenEmbedder to parse a project configuration:

      Configuration configuration = new DefaultConfiguration()
            .setUserSettingsFile( MavenEmbedder.DEFAULT_USER_SETTINGS_FILE )
            .setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE )
            .setMavenEmbedderLogger(new EmbedderLogger(LOG))
            .setClassLoader( Thread.currentThread().getContextClassLoader() );

        MavenEmbedder em = null;
        try {
            em = new MavenEmbedder(configuration);
        } catch (MavenEmbedderException e) {
            LOG.fatal("Error initialising MavenEmbedder", e);

        File pomFile = ...

I have several problems with it:

a) which version of maven-embedder can I use?
2.0.4 seems to be the latest 'official' version. However that doesn't work with the example
2.1 has only a snapshot version
3.0-alpha-6 doesn't contain a class MavenEmbedder
So, currently 3.0-alpha-2 is the best choice??

b) when trying the code above I get 
org.apache.maven.project.InvalidProjectModelException: Failed to validate POM for project
net.tipp24.argo:businesslogic at /tmp/MavenUtilsPom14163.xml
	at org.apache.maven.project.DefaultMavenProjectBuilder.validateModel(
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildWithProfiles(

The root cause seems to be that the version of one dependency is defined as a property which
is located in a POM which is part of a completely different project (i.e. the POM is not to
be found in the parent folder)
I guess that this method doesn't do a repository lookup. Do I have to do something special
do get MavenEmbedder to do a lookup to fetch missing artifacts?


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

View raw message