3

是否可以使用 maven scm 插件来标记发布,而不必使用发布插件?

我正在尝试执行以下操作,但它不起作用

从 pom 文件中提取

<scm>
  <connection>scm:git:ssh://myuser@gerrit/tutorial.git</connection>
  <developerConnection>scm:git:ssh://myuser@gerrit/tutorial.git</developerConnection>
</scm>

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-scm-plugin</artifactId>
  <version>1.7</version>
  <executions>
    <execution>
      <goals>
        <goal>tag</goal>
      </goals>
    </execution>
  </executions>
</plugin>

从命令行我做

mvn clean install scm:tag

Maven 返回以下错误

[INFO] 'scm:tag' 的一个或多个必需的插件参数无效/缺失

[0] 在插件“maven-scm-plugin”的定义中指定以下内容:

... 价值

-或者-

在命令行上,指定:'-Dtag=VALUE'

[INFO] ------------------------------------------------------------------------
[INFO] Trace 
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.apache.maven.plugins:maven-scm-plugin. Reason: Invalid or missing parameters: [Mojo parameter [name: 'tag'; alias: 'null']] for mojo: org.apache.maven.plugins:maven-scm-plugin:1.7:tag
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:723)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginParameterException: Error configuring: org.apache.maven.plugins:maven-scm-plugin. Reason: Invalid or missing parameters: [Mojo parameter [name: 'tag'; alias: 'null']] for mojo: org.apache.maven.plugins:maven-scm-plugin:1.7:tag
    at org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:1117)
    at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:722)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more
4

1 回答 1

9

http://maven.apache.org/scm/maven-scm-plugin/tag-mojo.html显示了两个必需的参数。您需要对它们进行 -D 或将它们放入 pom 中。

于 2012-05-16T15:14:30.517 回答