How to list active sub-modules in a Maven project?

前端 未结 8 1304
长发绾君心
长发绾君心 2020-12-24 13:26

I have a complex project where there are many directories that have POM files, but only some of which are sub-modules (possibly transitively) of a particular parent project.

8条回答
  •  难免孤独
    2020-12-24 14:03

    The solution I found is quite simple:

    mvn -B -f "$pom_file" org.codehaus.mojo:exec-maven-plugin:1.4.0:exec \
        -Dexec.executable=/usr/bin/echo \
        -Dexec.args='${basedir}/pom.xml'| \
        grep -v '\['
    

    This is a little bit tricky due to the need to grep out the [INFO|WARNING|ERROR] lines and make it usable for scripting but saved me a lot of time since you can put any expression there.

提交回复
热议问题