开发者

Is there a way in Maven to disable modules but still let the parent know them?

开发者 https://www.devze.com 2023-04-12 17:28 出处:网络
We have a number of modules defined in our parent pom, which are build regularily. Besides those we also have some other modules, which state our parent pom as their parent, but are not included as mo

We have a number of modules defined in our parent pom, which are build regularily. Besides those we also have some other modules, which state our parent pom as their parent, but are not included as modules in the parent pom right now. Some of them are not quite ready yet, others are not intended to be build contiuously and are therefore not included.

Some days ago I found the maven-versions-plugin a开发者_StackOverflow中文版nd I'd like to use it to advance the version number of our parent pom, using the update-child-modules goal, but for this obviously we need to have all modules listed in the parent pom.

So my question is, is there a way to list all modules in the parent pom, but still exclude some of them from being build when I call "mvn install"?


You could use a profile and put in it modules which you do not want to build. Something like this.

<profiles>
    <profile>
        <id>not-to-be-built</id>
        <modules>
            <module>module1</module>
            <module>module2</module>
        </modules>
    </profile>
</profiles>

You could run

mvn versions:update-child-modules -P not-to-be-built


Sure, use profiles and add the exceptional modules in there. You can then enable / disable any profile you like for a specific build.

0

精彩评论

暂无评论...
验证码 换一张
取 消