Java Maven MOJO - getting information from project POM

后端 未结 5 777
醉话见心
醉话见心 2021-02-05 02:50

I am working on a maven plugin. I seem to have a hard time figuring out, what would be a good way to get POM information from project in which you execute the MOJO ?

For

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 03:47

    The preferred syntax is now:

    @Parameter(defaultValue = "${project}", required = true, readonly = true)
    MavenProject project;
    

    You will have to add a dependency for maven-project to your plugin's pom:

    
        org.apache.maven
        maven-project
        2.0.6
    
    

    (Thanks to others who have supplied this information already. This answer combines them in one place.)

提交回复
热议问题