Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 921193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:50:03+00:00 2026-05-15T18:50:03+00:00

I am trying to call MavenCli from my OSGi plugin project. I have added

  • 0

I am trying to call MavenCli from my OSGi plugin project. I have added the correct libraries to my build path and to the manifest. I believe that I have done everything correct so far because when I add a main method to the class that calls maven and run it in eclipse, everything works as expected. When I run it from my OSGi plugin, I get the following error (with the maven switches -X -e):

Apache Maven 3.0-beta-1 (r935667; 2010-04-19 10:00:39-0700)
Java version: 1.6.0_16
Java home: C:\Java\jdk1.6.0_16\jre
Default locale: en_US, platform encoding: Cp1252
OS name: “windows 7” version: “6.1” arch: “amd64” Family: “windows”
[INFO] Error stacktraces are turned on.
[ERROR] Error executing Maven.

org.codehaus.plexus.component.repository.exception.ComponentLookupException: Component descriptor cannot be found in the component repository
role: org.apache.maven.Maven
roleHint:
classRealm: none specified
at org.codehaus.plexus.DefaultComponentRegistry.getComponentManager(DefaultComponentRegistry.java:435)
at org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:353)
at org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:178)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:383)
at org.apache.maven.cli.MavenCli.container(MavenCli.java:363)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:156)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:131)

I am using maven 3, beta 1, and using the following method call:

int x = MavenCli.doMain(params.toArray(new String[] {}), null);

where params contains things like “compile”, etc.

Any ideas? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:50:04+00:00Added an answer on May 15, 2026 at 6:50 pm

    I got this working by passing passing a classloader (this.getClass().getClassLoader()) to a DefaultContainerConfiguration and passing my DefaultContainerConfiguration to a DefaultPlexusContainer. Using the plexus, I was able to load instantiate a MavenExecutionRequestPopulator and a Maven object.

    Then when I try to execute any goals, I create a MavenExecutionRequest and set the Pom file, system and user properties. The system properties are obtained from the System and have my -Dfoo=x properties, etc.

    After that, I use a method I shamelessly stole (cant remember from where), but adapted a little …

    public MavenExecutionResult execute(MavenExecutionRequest request) {
            if (request == null) {
                return null;
            }
            MavenExecutionResult result;
            try {
                populator.populateDefaults(request);
                result = maven.execute(request);
            } catch (MavenExecutionRequestPopulationException ex) {
                ex.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return result;
        }
    

    Let me know if any further details are required. I would post all the code, but it is spread over numerous files. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call c# function from javascript the code i have tried
im trying to call a bean from a javascript, using a h:commandLink. i have
I'm trying to call an Antlr task in my Ant build.xml as follows: <path
Trying to call a SAP SOAP Web Service from a generated sudzc app shows
Im trying to call a method that will add or subtract 1 from a
I'm trying to call a method from another class with a simple button in
I'm trying to call a function present in one class from another class by
I'm trying to call a WCF service cross-domain using javascript, over http. I've added
While trying to call an EJB made using NETbeans (using jdk1.7) from a client
I trying to call some ejb bean method from tread. and getting error :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.