如何在 pom 中配置 maven-release-plugin 来模拟命令行上的 -Dgoals=deploy [英] How to configure the maven-release-plugin in pom to mimic -Dgoals=deploy on the command line

查看:83
本文介绍了如何在 pom 中配置 maven-release-plugin 来模拟命令行上的 -Dgoals=deploy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 pom 中配置 maven-release-plugin 的 perform mojo 执行 deploy 目标(与默认的 deploy site-deploy 相对).从命令行,它就像下面一样简单:

mvn release:perform -Dgoals=deploy


下面是配置 pom 的尝试,都失败了.

尝试 1:

<插件管理><插件><插件><artifactId>maven-release-plugin</artifactId><version>2.4</version><执行><执行><id>默认</id><目标><目标>执行</目标></目标><配置><arguments>-Dgoals=deploy -Dgit.tag.previous=</arguments></配置></执行></执行><配置><preparationGoals>全新安装</preparationGoals><arguments>-Dgit.tag.previous=</arguments></配置></插件></plugins></pluginManagement>...</build>

尝试 2:

<插件管理><插件><插件><artifactId>maven-release-plugin</artifactId><version>2.4</version><配置><preparationGoals>全新安装</preparationGoals><arguments>-Dgoals=deploy -Dgit.tag.previous=</arguments></配置></插件></plugins></pluginManagement>...</build>

尽管配置发生了这些变化,但在执行 mvn release:perform 时,我仍然看到以下日志行:

<代码>....[信息] 执行目标部署站点部署"...[警告] Maven 将以交互模式执行,但尚未为此 MavenInvoker 实例配置输入流.[INFO] [INFO] 正在扫描项目...[信息] [信息] -------------------------------------------------------------------------[INFO] [INFO] 建筑搜索服务[INFO] [INFO] 任务段:[deploy, site-deploy][信息] [信息] -------------------------------------------------------------------------...

注意任务段中的站点部署".


非常感谢任何帮助!

解决方案

你的想法太复杂了.perform#goals 描述了你想.所以它只是

<预><代码><配置><goals>部署</goals></配置>

I'm trying to configure the maven-release-plugin's perform mojo in the pom to only execute the deploy goal (as opposed to the default deploy site-deploy). From the command line, it's as simple as the following:

mvn release:perform -Dgoals=deploy


Here are attempts at configuring the pom, both of which failed.

Attempt 1:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4</version>
                <executions>   
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>perform</goal>
                        </goals>
                        <configuration>
                            <arguments>-Dgoals=deploy -Dgit.tag.previous=</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <preparationGoals>clean install</preparationGoals>
                    <arguments>-Dgit.tag.previous=</arguments>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    ...
</build>

Attempt 2:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <preparationGoals>clean install</preparationGoals>
                    <arguments>-Dgoals=deploy -Dgit.tag.previous=</arguments>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    ...
</build>

Despite these changes in configuration, I'm still seeing the following log line when I do a mvn release:perform:

....
[INFO] Executing goals 'deploy site-deploy'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building SearchService
[INFO] [INFO]    task-segment: [deploy, site-deploy]
[INFO] [INFO] ------------------------------------------------------------------------
...

Note the 'site-deploy' in task-segment.


Any help is very much appreciated!

解决方案

You're thinking way too complex. The perform#goals describes what you want. So it is just

<configuration>
  <goals>deploy</goals>
</configuration>

这篇关于如何在 pom 中配置 maven-release-plugin 来模拟命令行上的 -Dgoals=deploy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆