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

ぐ巨炮叔叔 提交于 2019-12-11 04:06:48

问题


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!


回答1:


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

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


来源:https://stackoverflow.com/questions/20103818/how-to-configure-the-maven-release-plugin-in-pom-to-mimic-dgoals-deploy-on-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!