it works after adding these two dependencies, thanks! :)

but it seems to me that there is something wrong with this dependency
injection mechanism.
it would be fantastic to have something that fails at compile time (as the
implicit in the scala language), but if that's not the case,
at least to throw an injection exception during runtime...

why there is not even an injection exception?


regards,
David


On Mon, Apr 29, 2013 at 11:19 PM, Stuart McCulloch <[email protected]>wrote:

> IIRC you need to also add dependencies to aether-connector-wagon and
> wagon-http...
>
>
> http://stackoverflow.com/questions/4206679/can-anyone-give-a-good-example-of-using-org-apache-maven-cli-mavencli-programatt/6255514#6255514
>
> --
> Cheers, Stuart
>
> On 29 April 2013 21:22, David Portabella <[email protected]>
> wrote:
>
> > I have a very simple project that starts maven programmatically, as
> > follows:
> >
> > import org.apache.maven.cli.MavenCli;
> > public class Example {
> >     public static void main(String[] args) throws Exception {
> >         new MavenCli().doMain(new String[]{"clean", "install"},
> > "/test/a_maven_project", null, null);
> >     }
> > }
> >
> > which uses only these two dependencies:
> >     <dependency>
> >       <groupId>org.apache.maven</groupId>
> >       <artifactId>maven-embedder</artifactId>
> >       <version>3.0.5</version>
> >     </dependency>
> >
> >     <dependency>
> >       <groupId>org.codehaus.plexus</groupId>
> >       <artifactId>plexus-utils</artifactId>
> >       <version>3.0.10</version>
> >     </dependency>
> >
> >
> > The program initializes maven with plexus, and every seems to work,
> > *but the execution fails if some dependencies of the
> > "/test/a_maven_project" maven project are not in the local repository.*
> > (all using default configurations (no custom settings.xml file))
> >
> > What can be the problem?
> >
> > I debugged building the "/test/a_maven_project" project in two ways:
> > 1- Running my Example project (it fails)
> > 2- Running "mvnDebug clean install" from the command line and debugging
> > remotely (it works)
> >
> > The difference is that in the second case,
> > DefaultRemoteRepositoryManager.connectorFactories has an instance of a
> > WagonRepositoryConnectorFactory,
> > while in the first
> > case DefaultRemoteRepositoryManager.connectorFactories is empty.
> >
> >
> >
> aether-impl-1.13.1-sources.jar!/org/sonatype/aether/impl/internal/DefaultRemoteRepositoryManager.java
> >
> >
> aether-connector-wagon/1.13.1/aether-connector-wagon-1.13.1.jar!/org/sonatype/aether/connector/wagon/WagonRepositoryConnectorFactory.class
> >
> > Any idea of why in the first case the
> > DefaultRemoteRepositoryManager.connectorFactories is empty?
> >
> > how to modify the Example to make it work?
> >
> >
> > Regards,
> > David Portabella
> >
>

Reply via email to