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
java linux maven ant


source to share


No one has answered this question yet

Check out similar questions:

2240
How to create an executable JAR with dependencies using Maven?
1011
How do I add local jar files to a Maven project?
877
Sorting an ArrayList of custom objects by property
866
How to solve "Executing plugins not covered by lifecycle config" for Spring Data Maven Builds
768
What is Maven Snapshot and why do we need it?
670
How do I tell Maven to use the latest dependency?
665
Force maven update
646
Working with "Xerces hell" in Java / Maven?
360
ant warning: "'includeantruntime' is not installed"
325
Why use Gradle instead of Ant or Maven?



All Articles
Loading...
X
Show
Funny
Dev
Pics