Maven properties in commandResource of Ant task <sshexec>
I am using Maven, Ant and sshexec to run some commands remotely. The maven antrun config is like this:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copyToStg</id>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="Backing up my version to path: user@/home/user/app_${maven.build.timestamp}"/>
<sshexec host="hostName"
trust="yes"
username="${username}"
password="${password}"
commandResource="${project.basedir}/src/main/resources/backupApp.sh"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
</dependencies>
</plugin>
and in my backupApp.sh file I have something like this:
#!/usr/bin/env bash
export ANT_HOME=/usr/local/apache-ant-1.7.1
export JAVA_HOME=/usr/java/jdk1.7.0_25
mkdir /xe/users/gold/HTDOCS/ca/backup/ca_${maven.build.timestamp}/ca_lib
cp /users/app/${jar.deployment.path}/${project.build.finalName}.jar /users/app/backup/app_${maven.build.timestamp}/${jar.deployment.path}/${project.build.finalName}.jar
cp /users/app/${projectName}.jnlp /users/app/backup/app_${maven.build.timestamp}/${projectName}.jnlp
I want maven to replace all properties in backupApp.sh with their values before running Ant script. I tried filtering resources in the resource directory but didn't replace them.
+3
source to share
No one has answered this question yet
Check out similar questions: