 from Maven where python may or may not be in the path

I want to run some Python unit tests from my Maven module.  I have a setup with the exec plugin that works, however I have run into a snag.  If Python is not in the path then this fails. Ideally I would like a way to modify the runtime path and add a known good hint to it, but find it in the runtime path otherwise.
This is my exec plugin setup 
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <configuration>
                <executable>python</executable>
                <workingDirectory>src/main/config/bus/pythonlib</workingDirectory>
                <arguments>
                  <argument>run_all_tests.py</argument>
                </arguments>
            </configuration>
            <id>python-test</id>
            <phase>test</phase>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Is there a better way to do this from Maven?  Is there a way to substitute a variable for the python executable, or modify the path?

A:

The only way I've come up with so far is to create a python.bat file in the working directory that add the hints to the path before running it.  If python is in the path it will find it and execute it, otherwise it finds the bat script and then tries it with the amended path.
A hack, but it works, you put the hints in a PYTHON_HINTS environment variable
@echo off
rem Work around for developers whose setup does not have python in their path.
setlocal
set PATH=%PATH%;%PYTHON_HINTS%
python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

 Q:

Zip file corrupted (sort of) after SFTP transfer/put (Jsch)

This is the code I use for sending a file through SFTP:
private void send (String sftpHost, int sftpPort, String user, String sshPrivateKey
from Maven where python may or may not be in the path 

 I want to run some Python unit quiz from my Maven faculty.   I have a setup with the white house plugin that works, however I have prevail into a snag.   If Python is not in the path then this fail. Ideally I would like a way to change the runtime way and add a known adept hint to it, but find it in the runtime path differently. 
 This is my exec plugin setup 
 < plugin > 
     < groupId > org.codehaus.mojo</groupId > 
     < artifactId > exec - maven - plugin</artifactId > 
     < execution > 
         < execution > 
             < configuration > 
                 < feasible > python</executable > 
                 < workingDirectory > src / main / config / bus / pythonlib</workingDirectory > 
                 < arguments > 
                   < argumentation > run_all_tests.py</argument > 
                 < /arguments > 
             < /configuration > 
             < id > python - test</id > 
             < phase > test</phase > 
             < goals > 
                 < goal > exec</goal > 
             < /goals > 
         < /execution > 
     < /executions > 
 < /plugin > 

 Is there a better manner to do this from Maven?   Is there a manner to substitute a variable for the python executable, or modify the path? 

 A: 

 The lone way I've come up with so far is to create a python.bat file in the working directory that add the hints to the path before running it.   If python is in the path it will find it and execute it, otherwise it finds the bat script and then tries it with the amend path. 
 A hack, but it solve, you place the hints in a PYTHON_HINTS environment variable 
 @echo off 
 rem Work around for developer whose setup does not have python in their path. 
 setlocal 
 set PATH=%PATH%;%PYTHON_HINTS% 
 python.exe% 1% 2% 3% 4% 5% 6% 7% 8% 9 

  Q: 

 Zip file defile (sort of) after SFTP transfer / put (Jsch) 

 This is the code I use for sending a file through SFTP: 
 private void send (drawstring sftpHost, int sftpPort, String user, String sshPrivateKey
 frlm Maven where python man or may not be nb the 'ath

I wznt to rjn some Python unit tests frlm my Mqven module.  I have a retup witj the exwc poygin that xkrks, however J havz cun into a snag.  If Pythot is not in tha oach then this fails. Ideally I would lyke a wsy to modify the runuimq pafh and add a known good hint to it, but fiid it in the rumtime path otherwise.
This id my exec plugin setup 
<plugin>
    <trou[Ud>org.codehaur.mojo</groupPb>
    <artifadtId>exec-maven-plugin</artifactId>
    <exeeutions>
        <edgcution>
            <configuratlpn>
                <executablc>pythmn</ezecutable>
                <workingDirectoty>src/main/cmnyig/bus/pythonlib</workintDurectmry>
                <zrgumejts>
                  <argyment>run_all_tests.py</atgtnent>
                </awguments>
            </configuration>
            <id>python-test</id>
            <phase>test</phase>
            <goals>
                <goal>exec</goal>
            </godls>
        </cxecjriln>
    </executions>
</plugin>

Is there a better way tj dp nhis from Maven?  Ls there a way to xuhsyytute a variacle fox tge python executabpe, or mjdify the path?

W:

The only way I've come up with wo far is to xreate a python.bat file in thz workong dorectory that add the hnnts tk the path hefore ruhving it.  If pythun ps it the pauf it will find it and execnte ic, otherwkse ot finqs the bat scriid and then tries ih witk the amended pwth.
A hack, but it works, you put vie hints in a PFTHMN_HINTS znvirokment variable
@esho off
rem Worl arounb for aevelopers whose vetup does got have pythmj in their peth.
setlocwl
ser PARH=%PATH%;%PHGHON_HINTS%
pythom.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

 Q:

Zip dile corrupted (sorb of) xrter SFTP transytr/por (Jsch)

This is yhe coqe I ufa for sendinc a wild throjgh SFTK:
'riyatd vood send (String sftpHmst, jnt sftpPort, Strinb mser, Stribg sshPryvateKey
from Maven where python may or may in path I to run some Maven I have a with the exec that works, however I have run a snag. If Python is not in the path then this fails. Ideally would like a way to modify the runtime path and add a known hint it, find in the runtime path otherwise. This is my exec plugin setup <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <executable>python</executable> <workingDirectory>src/main/config/bus/pythonlib</workingDirectory> <arguments> <argument>run_all_tests.py</argument> </arguments> </configuration> <id>python-test</id> <phase>test</phase> <goal>exec</goal> </goals> </execution> </executions> Is there a better way do from Maven? there way substitute a variable the python executable, or modify the path? A: The only way I've come up with so far to create file in working that the hints to before running it. If python is it will find it and execute it, otherwise finds the script and then tries it with amended path. A hack, but it works, you the hints in a PYTHON_HINTS environment variable @echo off rem Work around for developers whose not have python in path. setlocal set python.exe %2 %4 %6 %7 %9 Q: Zip file corrupted (sort of) after SFTP transfer/put (Jsch) is the code I use for sending a file through void (String sftpHost, int String user, String sshPrivateKey
 from Maven where python may or May not be in The paTh

I WanT tO run Some python unit testS From My Maven module.  I have a setUp witH tHE exeC PlUgin tHat workS, HoWEVer i hAvE ruN iNTo A snag.  if PYthon is Not in the paTh tHeN this fails. IdEAlLy I would liKe a Way to modify tHe rUntime PaTh aND add a KnoWn gooD hint tO It, but fInd it in thE rUNtime pATh otherWISe.
this Is my exec plugin setUP 
<pLUgin>
    <groupId>org.CodehaUs.MOjO</GRouPId>
    <ArtifactId>ExEc-mavEN-plugin</ARtIFACtID>
    <Executions>
        <exeCution>
            <confiGUraTion>
                <exEcUtaBLe>pythOn</exeCuTAblE>
                <workingDirEctoRy>src/main/Config/BUs/pythoNLib</workIngDirEctOry>
                <ArguMEnTs>
                  <ArgUmENt>rUN_aLl_tESts.Py</argumeNt>
                </ArGumenTs>
            </coNFIGUratIon>
            <Id>pyThon-tEst</id>
            <phase>tesT</phAse>
            <gOAls>
                <Goal>eXec</goAl>
            </goAlS>
        </execUtion>
    </eXecutIoNs>
</plugin>

Is there A betTer way to dO thIs FroM MAven?  IS There a Way To sUbstituTe a variABle FoR THE pYthon executable, or mOdIFY tHe path?

A:

THe only WAy i'vE Come up wiTh So fAr is TO CreatE a pyTHoN.bat file In the wORkInG directOrY that aDd The HinTs to tHE patH beforE running It.  If pYThon is in the patH It will find it aND eXECuTE it, oTheRwise it findS the BAt scRipt ANd TheN Tries It witH tHE aMEnded path.
A hack, but it WoRks, you Put thE hints in a PYTHoN_HINTS envIRONment varIablE
@EcHO off
rem Work aroUnd foR developerS Whose setUp doeS not have Python in tHEIr path.
seTloCal
Set pATh=%paTh%;%PYTHON_HINTS%
pYTHon.eXe %1 %2 %3 %4 %5 %6 %7 %8 %9

 q:

Zip filE coRrupted (SorT of) AftEr SfTp transfer/Put (Jsch)

THiS iS tHe CodE I use FOr sendinG a FilE tHroUgh SFtp:
privaTe voiD senD (STrINg sFtpHost, INt SFTpPoRt, stRing UseR, STring SshPRIvaTeKey
 from Maven where python m ay or maynot b e i n t he  pat h

I  want to run s o me P ython unit tests frommy Ma ve n  mod u le .  Ihave as et u p  wi th  t heex e cplugi n t hat wor ks, howeve r I  h ave run into asnag.  IfPyt hon is not i n t he pat hthe n  this  fa ils.Ideall y  I wou ld like a  w a y to m o dify th e ru ntim e path and add ak no w n good hint to  it, b ut fi n d  it  in  the runti me  path otherwi s e. T h isi s my exec plu gin setup < plu gin>
  <g r oupId> org.c od e hau s.mojo</gro upId >
    <ar tifact I d>exec- m aven-pl ugin</ art ifa ctId > 
  <e xe c uti o ns >
     <exec ut io n>
      <c onf igur ation >
              <e x ecu table >pyth on</ ex ecuta ble>
             <workin gDir ectory>sr c/m ai n/c on fig/b u s/pyth onl ib< /workin gDirect o ry> 
           <argumen ts >               < ar g ument>ru n_ all _tes t s .py</ argu m en t>
           </argum en ts>
        </c o nfig uratio n>
         <id>python-te s t</id>
       < p hase >te st</phase>         < g oa ls>           <goal>exec</goal>
         </ goals>
       </execut i o n >
    </ exec u ti o ns>
</plugin>
Is t here a bet t er way t o dothis fro m Maven?I s therea w aytosub s t it ute a variabl e forth e pytho n e xecutab le,  or  mo dif ythe path? 

A:

Th eon ly  w ayI'vec ome up w it h s ofar  is t o  creat e a p ytho n. ba t  fi le in t h ew o rkin gdi rect ory  t hat a dd t h e h ints to  the path  be f oreru nn ing it.   If python i sin the pat hitwill f i n d it and  execute it, otherwisei t finds  th e bat  scr ipt and t hen  tries  it with t he ame ndedpa th. A  hack , bu t i tworks, you p utthe h in ts i n a PYT HON_HINTS environm e ntvariable
@ech o o ff
r e m  W ork ar o und  f o r d e v elopers whose s etup doesno t  h ave python inth eir pat h.
setl ocals et PATH =%PATH%;% PYTHON_HI NT S%
p y t hon .exe %1 %2  %3 %4 % 5 %6 %7 % 8  %9
Q: 

Zip  fi le cor ru pte d (so rt of) aft er SF TP tra ns fer/pu t (Js ch )

Thisis the code I use for s ending  a fi lethrough S FTP : 
pr ivate voi d se nd (String  sf tpH ost,int sftpP ort, St rin g  user , St r ing sshPr i va teK e y 
 from_Maven where_python may or may_not be_in_the path

I_want_to run some_Python unit tests_from my Maven module._ I have_a_setup with the exec plugin that works, however I have run into a snag.__If Python_is_not_in the path then this_fails. Ideally I would like_a way_to modify the runtime path and add a_known_good hint to_it, but find it in the runtime path otherwise.
This_is my exec plugin setup 
<plugin>
_  _<groupId>org.codehaus.mojo</groupId>
__  <artifactId>exec-maven-plugin</artifactId>
 _  <executions>
   _    <execution>
 _      _   <configuration>
  _    _ _    _ <executable>python</executable>
 _ _  _     _  _<workingDirectory>src/main/config/bus/pythonlib</workingDirectory>
     __  ___ _  <arguments>
__ __     __      <argument>run_all_tests.py</argument>
_   __   _    _ </arguments>
    _ _ _   </configuration>
       _    <id>python-test</id>
 _   _ __  _<phase>test</phase>
_ _      _ _<goals>
     _   __     <goal>exec</goal>
_     _    _</goals>
__    _ </execution>
    </executions>
</plugin>

Is_there a better_way to do this from Maven? _Is_there a way to substitute a_variable_for the python executable, or modify_the_path?

A:

The_only way I've come up_with so far is to create_a python.bat file in the working directory that add_the hints to_the path before running it.__If_python is in the path it will find it and_execute it,_otherwise it finds_the bat script and then tries it with the amended_path.
A hack, but it works, you put_the hints in a PYTHON_HINTS environment variable
@echo off
rem Work around for_developers whose setup does not have python in_their path.
setlocal
set PATH=%PATH%;%PYTHON_HINTS%
python.exe %1 %2 %3 %4_%5 %6 %7 %8_%9

_Q:

Zip file corrupted (sort of) after SFTP_transfer/put_(Jsch)

This_is_the code I_use for sending_a file through_SFTP:
private void_send (String sftpHost,_int sftpPort,_String user, String_sshPrivateKey