Hi,

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 = ...
        em.readProject(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 here http://maven.apache.org/guides/mini/guide-embedding-m2.html
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(DefaultMavenProjectBuilder.java:426)
        at 
org.apache.maven.project.DefaultMavenProjectBuilder.buildWithProfiles(DefaultMavenProjectBuilder.java:327)
        at 
org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:137)

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?


thanks
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to