【问题标题】:Maven build have to run python script to generate a web.xmlMaven 构建必须运行 python 脚本来生成 web.xml
【发布时间】:2013-11-17 21:44:57
【问题描述】:

我正在使用 exec-maven-plugin 并且 pom 正在编译,但是当我编译我的项目时它似乎没有执行这个插件:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
  <executions>
     <execution>
        <configuration>
           <executable>python</executable>
           <workingDirectory>scripts/python/</workingDirectory>
           <arguments>
              <argument>webxmlgen.py</argument>

              <argument>argument1</argument>
              <argument>argument2</argument>
           </arguments>
        </configuration>
        <id>generation</id>
        <phase>generate</phase>
        <goals>
           <goal>exec</goal>
        </goals>
     </execution>
  </executions>
</plugin>

我是不是忘记了什么?我也不确定我必须使用的阶段和目标......

编辑:

我已经删除了 workingDirectory 标记并将其直接放在参数中,现在它可以与阶段 generate-ressources 一起使用,谢谢!

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
  <executions>
     <execution>
        <configuration>
           <executable>python</executable>
           <arguments>
              <argument>scripts/python/webxmlgen.py</argument>

              <argument>argument1</argument>
              <argument>argument2</argument>
           </arguments>
        </configuration>
        <id>generation</id>
        <phase>generate-ressources</phase>
        <goals>
           <goal>exec</goal>
        </goals>
     </execution>
  </executions>
</plugin>

【问题讨论】:

    标签: python maven exec-maven-plugin


    【解决方案1】:

    phase 告诉 Maven 何时执行它,goal 告诉它在达到阶段时在插件上调用哪个目标。

    您的问题是没有generate 阶段。 Here is a list。请改用generate-resources

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 1970-01-01
      • 2015-11-14
      • 1970-01-01
      • 2013-12-14
      • 2020-08-19
      • 1970-01-01
      相关资源
      最近更新 更多