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

时间:2013-11-20 18:19:09

标签: java maven maven-release-plugin

我正在尝试将pven 中的maven-release-plugin perform mojo 配置为执行deploy目标(如反对默认的deploy site-deploy)。从命令行开始,它就像下面这样简单:

mvn release:perform -Dgoals=deploy


以下是配置pom的尝试,两者都失败了。

尝试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>

尝试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>

尽管配置发生了这些变化,但当我执行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] ------------------------------------------------------------------------
...

请注意任务段中的“site-deploy”。


非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

你的想法太复杂了。 perform#goals描述了您想要的内容。 所以它只是

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