I created a maven project and i'm trying to run an external script. In this external script, i use read command to ask a question and get an answer.
It works if i do a sudo mvn package with exec-maven-plugin
But, but, but :
- If i do a sudo mvn package, my script doesn't stop at read command.
- If i do a sudo mvn release:prepare with exec-maven-plugin, my script doesn't stop at read command.
- If i do a sudo mvn release:prepare with maven-antrun-plugin, my script doesn't stop at read command.
And obviously, i need to do a release :)
I tried to to change the first line of my script (#/usr/bin/bash, sh, ...) with other syntaxes for read command...
Is anyone have a solution to help me ???
Here the concerned part of my pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>initialisation</id>
<phase>initialize</phase>
<configuration>
<tasks>
<exec dir="${project.basedir}" executable="${project.basedir}/livraison/outils/0_init_livraison.ksh" failonerror="true">
<arg line="${project.name} ${project.version} ${ancienneVersion}" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Here the concerned part of my 0_init_livraison.ksh
#!/bin/ksh
echo -e "| EXECUTION DU SCIPT generation_livrable.ksh \n"
echo "SHELL : $SHELL"
boucle="boucler"
while [ $boucle -eq "boucler" ]
do
echo -ne " Souhaitez-vous forcer la procedure (oui/non)? "
read rep1
case "$rep1" in
o|O|y|Y|oui|Oui|OUI|yes|Yes|YES)
echo ""
break
;;
n|N|non|Non|NON|no|No|NO)
echo -e " Abandon de la procedure..."
boucle=""
exit 1
;;
*)
echo -e " Reponse incomprehensible.\c"
esac
done
The last lines of my console when i do a sudo mvn package ( And then, nothing happens. It seems blocked because of an infinite while loop)
[INFO] --- maven-antrun-plugin:1.8:run (initialisation) @ MyProject---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
main:
[exec] | EXECUTION DU SCIPT generation_livrable.ksh
[exec]
[exec] SHELL : /bin/bash
Thanks for the reading :)
EDIT :
I tried to use property with maven-antrun-plugin. But i have a similar problem: antrun input task doesn't work during mvn release:prepare operation