当前位置: 首页 > 知识库问答 >
问题:

无法执行目标组织。科德豪斯。mojo:exec maven插件:项目ors上的1.6.0:exec(默认值):参数“executable”缺失或无效

唐高卓
2023-03-14

当我试图执行mvn-DskipTests=true-Passembly assembly:directory exec:exec命令以生成二进制文件时,我无法执行目标组织。科德豪斯。mojo:exec maven插件:项目ors上的1.6.0:exec(默认):参数“executable”丢失或错误无效。我还应用了源目标1.8内部配置,但仍然得到相同的错误。

<profile>
      <id>execute</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <goals><goal>java</goal></goals>
                  </execution>
              </executions>
          <configuration>
          <mainClass>org.marketcetera.ors.OrderRoutingSystem</mainClass>
          <systemProperties>
              <systemProperty>
                  <key>org.marketcetera.appDir</key>
                  <value>src/test/cmd_exec</value>
              </systemProperty>
          </systemProperties>
          <classpathScope>test</classpathScope>
          </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Command-line execution of the ORS (with DB initialization). -->
    <profile>
      <id>executeDBInit</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <goals><goal>java</goal></goals>
                  </execution>
              </executions>
          <configuration>
        <mainClass>org.marketcetera.ors.DBInit</mainClass>
        <arguments>
          <argument>org.marketcetera.ors.OrderRoutingSystem</argument>
        </arguments>
        <systemProperties>
          <systemProperty>
            <key>org.marketcetera.appDir</key>
            <value>src/test/cmd_exec</value>
          </systemProperty>
        </systemProperties>
        <classpathScope>test</classpathScope>
          </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Command-line execution of the miniscule exchange. -->
    <profile>
      <id>exchange</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <goals><goal>java</goal></goals>
                  </execution>
              </executions>
          <configuration>
        <mainClass>org.marketcetera.ors.exchange.Main</mainClass>
        <arguments>
          <argument>exchange.xml</argument>
        </arguments>
        <systemProperties>
          <systemProperty>
            <key>org.marketcetera.appDir</key>
            <value>src/test/cmd_exec</value>
          </systemProperty>
        </systemProperties>
        <classpathScope>test</classpathScope>
          </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Security administration utility. -->
    <profile>
      <id>cli</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <goals><goal>java</goal></goals>
                  </execution>
              </executions>
          <configuration>
        <mainClass>org.marketcetera.ors.security.ORSAdminCLI</mainClass>
        <!-- -Dexec.args="-u admin ..." -->
        <systemProperties>
          <systemProperty>
            <key>org.marketcetera.appDir</key>
            <value>src/test/cmd_exec</value>
          </systemProperty>
        </systemProperties>
        <classpathScope>test</classpathScope>
          </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Assembly. -->
    <profile>
      <id>assembly</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals><goal>single</goal></goals>
                      <configuration>
                          <formats><format>dir</format></formats>
                          <descriptors>
                              <descriptor>src/main/assembly/assembly.xml</descriptor>
                          </descriptors>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals><goal>exec</goal></goals>
                      <configuration>
              <executable>${perl.path}</executable>
                          <arguments>
                              <argument>../tools/scripts/createScript.pl</argument>
                              <argument>${project.build.directory}/${project.artifactId}</argument>
                              <argument>ors</argument>
                              <argument>org.marketcetera.ors.OrderRoutingSystem</argument>
                              <argument>${project.build.directory}/${project.artifactId}</argument>
                              <argument>orsadmin</argument>
                              <argument>org.marketcetera.ors.security.ORSAdminCLI</argument>
                          </arguments>
                      </configuration>
                  </execution>
              </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

共有3个答案

禄光霁
2023-03-14

我通过在pom中指定所需的插件解决了这个错误。xml如下所示

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <executable>java</executable>
                    <arguments>
                        <argument>-classpath</argument>
                        <classpath />
                        <argument>com.ocloud.Alarm.App</argument>
                    </arguments>
                </configuration>
            </plugin>
史默
2023-03-14

您忘了指定perl。路径中的变量

<executable>${perl.path}</executable>

将此添加到您的pom父级:

<properties>
    <perl.path>path/to/perl</perl.path>       
</properties>

隆礼骞
2023-03-14

从exec-maven-plugin版本1.6.0开始,它将出现

尝试更改命令行,替换exec:exec@foo对于exec:exec,插件块更改为包含id foo,如下所示:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
          <executions>
              <execution>
                  <id>foo</id>
                  <phase>package</phase>
                  <goals><goal>exec</goal></goals>
                  <configuration>
          <executable>${perl.path}</executable>
                      <arguments>
                          <argument>../tools/scripts/createScript.pl</argument>
                          <argument>${project.build.directory}/${project.artifactId}</argument>
                          <argument>ors</argument>
                          <argument>org.marketcetera.ors.OrderRoutingSystem</argument>
                          <argument>${project.build.directory}/${project.artifactId}</argument>
                          <argument>orsadmin</argument>
                          <argument>org.marketcetera.ors.security.ORSAdminCLI</argument>
                      </arguments>
                  </configuration>
              </execution>
          </executions>
      </plugin>
 类似资料: