How to inherit the current path when invoking Maven's exec-maven-plugin?

Posted by wishihadabettername on Stack Overflow See other posts from Stack Overflow or by wishihadabettername
Published on 2010-05-12T17:11:43Z Indexed on 2010/05/12 17:14 UTC
Read the original article Hit count: 256

Filed under:
|

I have an <exec-maven-plugin> which calls an external command (in this case, svnversion). The command is in the path for the current user.

However, when a separate shell is spawned by the plugin, the path is not initialized. I don't want to hardcode or define a variable for each external command (there would be too much to maintain, especially that there are both Windows and *nix users).

My pom.xml contains the following:

  <plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>exec-maven-plugin</artifactId>
 <version>1.1</version>
 <executions>
  <execution>
   <id>svnversion-exec</id>
   <phase>process-resources</phase>
   <goals>
    <goal>exec</goal>
   </goals>
   <configuration>
    <executable>svnversion</executable>
    <arguments>
     <argument><![CDATA[ >version.txt ]]></argument>
    </arguments>
   </configuration>
  </execution>
 </executions>
  </plugin>

Currently I get the following output:

[INFO] [exec:exec {execution: svnversion-exec}] 'svnversion' is not recognized as an internal or external command, operable program or batch file.

[ERROR] BUILD ERROR: Result of cmd.exe /X /C "svnversion >version.txt" execution is: '1'.

Thank you!

© Stack Overflow or respective owner

Related posts about maven

Related posts about maven-2