java 无法执行目标组织,codehaus,mojo:exec-maven-plugin:1.6.0:exec(默认)在项目或:参数“executable”缺失或无效

qni6mghb  于 2023-02-02  发布在  Java
关注(0)|答案(5)|浏览(548)

当我试图执行mvn -DskipTests=true -Passembly程序集:目录exec:exec命令,使二进制我得到未能执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:exec(默认)项目或:参数“executable”缺失或无效错误。我还在配置中应用了Source Target 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>
jutyujz0

jutyujz01#

exec-maven-plugin版本1.6.0开始,除非指定id,否则<execution>块中的<configuration>部分似乎会被忽略。
尝试更改您的命令行,用exec:exec@foo替换exec:exec,并将插件块更改为包含idfoo,如下所示:

<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>
dwthyt8l

dwthyt8l2#

我通过在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>
x9ybnkn6

x9ybnkn63#

您忘记在<executable>标记中指定perl.path变量。

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

将此添加到您的pom父项:

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

tnkciper4#

在执行前编译

clean compiler:compile exec:java
k7fdbhmy

k7fdbhmy5#

如果exec-maven-plugin插件是在子maven模块中配置的,并且您从父目录运行该命令,则也可能发生The parameter 'executable' is missing or invalid错误。
要解决这个问题,只需将您的工作目录更改为使用插件的目录。

相关问题