Running externail script on BuildAgent

Hi, people.

Here is a little problem...

Have an BuildAgent running on Win7. Have a project. In project's pom.xml have:

                        <artifactId>maven-antrun-plugin</artifactId>
                        <configuration>
                            <tasks>
                                <exec executable="file.bat"/>
                            </tasks>

File file.bat located in directory database_source which is project directory.

So - when I set full pathname inside pom.xml like:

   <exec executable="C:\BuildAgent\work\5bc5889cb53ed441\database_source\file.bat"/>

It works. But if using relative path (like just executable="file.bat") - I got next in build-log:

[***database_source] [INFO] Executing tasks

[12:17:54][***:database_source] An  Ant BuildException has occured: Execute failed: java.io.IOException:  Cannot run program "file.bat" (in directory  "C:\BuildAgent\work\5bc5889cb53ed441\database_source"): CreateProcess  error=2, The system cannot find the file specified



If use full path - it works:


[***:database_source] [INFO] Executing tasks
[12:20:17][***:database_source] [exec]

[12:20:17][***:database_source] [exec] C:\BuildAgent\work\5bc5889cb53ed441\database_source>set  CURR_DIR=C:\BuildAgent\work\5bc5889cb53ed441\database_source

[12:20:17][***:database_source] [exec]

[12:20:17][***:database_source] [exec] C:\BuildAgent\work\5bc5889cb53ed441\database_source>echo C:\BuildAgent\work\5bc5889cb53ed441\database_source

[12:20:17][***:database_source] [exec] C:\BuildAgent\work\5bc5889cb53ed441\database_source



So, script running from right directory:


echo C:\BuildAgent\work\5bc5889cb53ed441\database_source


Script content (just for tests):



set CURR_DIR=%cd%
echo INNT
echo %CURR_DIR%


So - if it's running from database_source - why it wan't accept path like "file.bat"?

Thanks for tips.

Please sign in to leave a comment.