当我尝试执行 mvn -DskipTests = true -Passembly程序集:目录exec:exec 命令以生成二进制文件时我得到了 无法在项目ors上执行目标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>
答案 0 :(得分:1)
从exec-maven-plugin
版本1.6.0开始,<configuration>
块中的<execution>
部分会被忽略,除非您指定了ID。
尝试更改命令行,将 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>
答案 1 :(得分:0)
您忘了在perl.path
代码中指定<executable>
变量。
<executable>${perl.path}</executable>
将此添加到您的pom父级:
<properties>
<perl.path>path/to/perl</perl.path>
</properties>