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

  • SEARCH
  • Home
  • 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 371789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:08:53+00:00 2026-05-12T14:08:53+00:00

In a previous question I got an answer for downloading an artifact from the

  • 0

In a previous question I got an answer for downloading an artifact from the Maven repository. This works well for me, but I need to read the MavenProject for the downloaded artifact.

What is the best way for me to read the MavenProject for the downloaded artifact in my plugin?

  • 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-12T14:08:54+00:00Added an answer on May 12, 2026 at 2:08 pm

    You can use the MavenProjectBuilder to resolve the artifact and read the downloaded pom into a MavenProject. The buildFromRepository() method will obtain the artifact (if needed) from the remote repositories so there is no need to download it before reading.

    These are the changes needed to the previous answer resolve the maven project:

    //other imports same as previous answer
    import org.apache.maven.project.MavenProject;
    import org.apache.maven.project.MavenProjectBuilder;
    import org.apache.maven.project.ProjectBuildingException;
    
    /**
     * Obtain the artifact defined by the groupId, artifactId, and version from the
     * remote repository.
     * 
     * @goal bootstrap
     */
    public class BootstrapAppMojo extends AbstractMojo {
    
        /**
         * Used to resolve the maven project.
         * 
         * @parameter expression=
         *            "${component.org.apache.maven.project.MavenProjectBuilder}"
         * @required
         * @readonly
         */
        private MavenProjectBuilder mavenProjectBuilder;
    
        //rest of properties same as before.
    
        /**
         * The target pom's version
         * 
         * @parameter expression="${bootstrapVersion}"
         * @required
         */
        private String bootstrapVersion;
    
        public void execute() throws MojoExecutionException, MojoFailureException {
            try {
                Artifact pomArtifact = this.factory.createArtifact(
                    bootstrapGroupId, bootstrapArtifactId, bootstrapVersion,
                    "", bootstrapType);
    
                MavenProject project = mavenProjectBuilder.buildFromRepository(
                    pomArtifact, this.remoteRepositories, this.localRepository);
    
                //do something with the project...
            } catch (ProjectBuildingException e) {
                getLog().error("can't build bootstrapped pom", e);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just got this answer from a previous question and it works a treat! SELECT
This is a CSS related question, I got one good answer from my previous
This is a follow up to a previous question; I got an answer I
I got a good answer to my previous question but it's actually even more
I got the below code from an answer on a previous question here .
This question follows on from a previous question, that has raised a further issue.
In a previous question ( Get object call hierarchy ), I got this interesting
In my previous question I got an excellent answer that helped me detect where
This maybe a continuation from 2 of my previous question, or maybe it's a
Hello I searched for an answer to this question but didn't find any here.

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.