2017-07-04 15 views
0

exec-maven-pluginを使用して成果物の名前を変更しようとしています。 (私は同じ位相とゴールで異なる目的のためにそれを使用していますようantrunプラグインを使用する必要はありません。)mavenビルドの実行に失敗しました: '127'

プラグインのpom.xmlに:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>exec-maven-plugin</artifactId> 
    <version>1.1.1</version> 
    <executions> 
     <execution> 
     <id>some-execution</id> 
     <phase>package</phase> 
     <goals> 
      <goal>exec</goal> 
     </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <executable>mv "${project.build.directory}/${project.artifactId}-${project.version}-myapp.jar" "${project.build.directory}/${project.artifactId}-${project.version}.app"</executable> 
    </configuration> 
    </plugin> 

それはアーティファクトの名前を変更するために失敗しましたそしてエラーの下に示します:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:exec (some-execution) on project cep: Result of /bin/sh -c cd /home/XYZ/workspace/myapp/solutions/cep && "mv "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT-myapp.jar" "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT.app"" **execution is: '127'**. -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:exec (some-execution) on project cep: Result of /bin/sh -c cd /home/XYZ/workspace/myapp/solutions/cep && "mv "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT-myapp.jar" "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT.app"" execution is: '127'. 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Result of /bin/sh -c cd /home/XYZ/workspace/myapp/solutions/cep && "mv "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT-myapp.jar" "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT.app"" execution is: '127'. 
    at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:283) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 

DEBUGログ:

[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.1.1:exec from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.1.1, parent: [email protected]] 
[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.1.1:exec' with basic configurator --> 
[DEBUG] (f) basedir = /home/XYZ/workspace/myapp/solutions/cep 
[DEBUG] (f) classpathScope = compile 
[DEBUG] (f) executable = mv "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT-myapp.jar" "/home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT.app" 
[DEBUG] (f) project = MavenProject: com.myco:cep:0.1.0-SNAPSHOT @ /home/XYZ/workspace/myapp/solutions/cep/pom.xml 
[DEBUG] (f) session = [email protected] 
[DEBUG] (f) skip = false 
[DEBUG] -- end configuration -- 
[INFO] /bin/sh: 1: mv /home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT-myapp.jar /home/XYZ/workspace/myapp/solutions/cep/target/cep-0.1.0-SNAPSHOT.app: **not found** 

これらのログから、私は何かがあると確信しています行方不明ですが、私は何を見つけることができません。私のOSはubuntu /bin/shです。 lsには、指定された場所にある成果物も一覧表示されます。

答えて

0

解決済み! 私は間違っていました。 <executable>タグにはコマンドのみが含まれています。引数は<arguments>の下で定義されます。

更新プラグインの定義を参照してください。

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>exec-maven-plugin</artifactId> 
    <version>1.1.1</version> 
    <executions> 
    <execution> 
      <id>some-execution</id> 
       <phase>package</phase> 
       <goals> 
        <goal>exec</goal> 
       </goals> 
      <configuration> 
        <executable>mv</executable> 
          <arguments> 
            <argument>${project.build.directory}/${project.artifactId}-${project.version}-myapp.jar</argument> 
            <argument>${project.build.directory}/${project.artifactId}-${project.version}.app</argument> 
          </arguments> 
      </configuration> 
    </execution> 
    </executions> 
    </plugin> 
関連する問題