简体   繁体   English

如何在pom中配置Maven-release-plugin以在命令行上模拟-Dgoals = deploy

[英]How to configure the maven-release-plugin in pom to mimic -Dgoals=deploy on the command line

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 ). 我正在尝试将pom中的maven-release-plugin的perform mojo配置为执行deploy目标(与默认的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. 这是配置pom的尝试,但均失败。

Attempt 1: 尝试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: 尝试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 : 尽管配置进行了这些更改,但是当我执行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. perform#goals描述了您想要的内容。 So it is just 就是这样

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM