在特定阶段后使用 Maven 运行任务

发布于 2024-09-25 08:27:59 字数 659 浏览 1 评论 0原文

如何在 Maven Eclipse:Eclipse 阶段运行任务?

<groupId>org.codehaus.mojo</groupId>

<artifactId>exec-maven-plugin</artifactId>

<version>1.2</version>

<executions>

    <execution>

        <phase>eclipse:eclipse</phase>

        <goals>

            <goal>java</goal>

        </goals>

        <configuration>

            <executable>java</executable>

            <mainClass>a.b.c.Main</mainClass>

        </configuration>

    </execution>

</executions>

这个配置好像不太好吧。

how run a task post maven eclipse:eclipse phase ?

<groupId>org.codehaus.mojo</groupId>

<artifactId>exec-maven-plugin</artifactId>

<version>1.2</version>

<executions>

    <execution>

        <phase>eclipse:eclipse</phase>

        <goals>

            <goal>java</goal>

        </goals>

        <configuration>

            <executable>java</executable>

            <mainClass>a.b.c.Main</mainClass>

        </configuration>

    </execution>

</executions>

this configuration seems not ok.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愿得七秒忆 2024-10-02 08:27:59

如何在 Maven Eclipse:Eclipse 阶段运行任务?

你不能,eclipse:eclipse 不是一个阶段。

要么将一些目标绑定在同一阶段(如果这甚至有意义),它们就会按照声明顺序执行。

或者从命令行调用它们(并且可以选择提供从命令行运行时使用的默认配置)。例如,您可以执行以下操作:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2</version>
  <executions>
    <execution>
      <id>default-cli</phase>
      <configuration>
        <executable>java</executable>
        <mainClass>a.b.c.Main</mainClass>
      </configuration>
    </execution>
  </executions>
</plugin>

然后调用:

mvn eclipse:eclipse exec:java

how run a task post maven eclipse:eclipse phase ?

You can't, eclipse:eclipse is not a phase.

Either bind some goals on the same phase (if this even makes sense) and they would get executed in their declaration order.

Or invoke them from the command line (and optionally provide a default configuration to be used when running from the command line). For example, you could do:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2</version>
  <executions>
    <execution>
      <id>default-cli</phase>
      <configuration>
        <executable>java</executable>
        <mainClass>a.b.c.Main</mainClass>
      </configuration>
    </execution>
  </executions>
</plugin>

And then invoke:

mvn eclipse:eclipse exec:java
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文