我知道如何避免在发布过程中部署模块。不清楚的是如何避免一开始就构建模块。例如,我的项目包含一个“示例”模块。这需要很长时间才能构建,并且从未部署到 Maven Central,所以我想完全避免构建它(但仅在部署期间)。有任何想法吗?
2 回答
在这种情况下,最好的办法是使用配置文件并将示例放入可以由配置文件激活的单独模块中。这可以防止在发布期间构建,但可以通过激活配置文件在通常的开发等期间构建。
If you're using the Maven Release Plugin, you will need to take care of both the prepare and the release steps, since projects are usually built in both steps.
For the prepare step, I would try the preparationGoals
parameter, which by default uses clean verify
, which includes a build of the project. Maybe you can try setting it to clean
only to avoid the build.
http://maven.apache.org/plugins/maven-release-plugin/perform-mojo.html
For the perform step, take a look at the goals
parameter, which by default is set to deploy
. You can override this by specifying clean
only.
http://maven.apache.org/plugins/maven-release-plugin/perform-mojo.html
I haven't tried this exact combination, so I don't know whether this will have any side-effects on the rest of the build.