AbstractMavenLifecycleParticipant:afterProjectsRead()更新然后重新读取poms

时间:2017-02-10 17:32:17

标签: maven maven-3 maven-plugin

是否有任何Maven API我可以重新读取pom文件。

我有如下的Maven扩展程序(请参阅TODO ):

    @Component(role = AbstractMavenLifecycleParticipant.class, hint = "update")
    public class UpdateExtension extends AbstractMavenLifecycleParticipant {

        @Override
        public void afterProjectsRead(MavenSession session) throws MavenExecutionException {

            for (MavenProject project : projects) {
                File pomFile = project.getFile();

                // Update pomFile version and certain dependency versions
            }

            // TODO Get Maven to read the project pom files again
        }

        @Override
        public void afterSessionStart(MavenSession session) throws MavenExecutionException {}

        @Override
        public void afterSessionEnd(MavenSession session) throws MavenExecutionException {}
    }

0 个答案:

没有答案