maven - Ant if file available does not find file as property -


i using following ant code inside maven

<properties>     <uninstaller.filename>myname</uninstaller.filename>     .... </properties> <if>     <available file="${project.build.directory}/${uninstaller.filename}"/>     <then>         <echo> run commands.... </echo>                                      <echo> [info]   done! </echo>         <echo> [info]   running un-installation...</echo>         <exec dir="${project.build.directory}"           executable="${project.build.directory}/${uninstaller.filename}**" failonerror="false">      </exec>     <echo> [info]   progrm uninstalled successfully!</echo>  </then> <else>     <echo>[info]    no previous program found...</echo> </else> </if> 

the code not find uninstaller ( name myname , and not myname.*) when wrote "hard coded" -

<available file="${project.build.directory}/myname"/> 

it work... checked same name , file exists.
the property defined.
idea? available?

thanks

you don't need specify project in property.

try file mvn install.

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"          xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>test</groupid>     <artifactid>test</artifactid>     <version>1.0-snapshot</version>     <name>test</name>     <url>http://maven.apache.org</url>      <properties>         <dir.name>./</dir.name>         <uninstaller.filename>pom.xml</uninstaller.filename>     </properties>      <!-- build configuration -->     <build>         <plugins>             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-antrun-plugin</artifactid>                 <version>1.7</version>                 <dependencies>                     <dependency>                         <groupid>ant-contrib</groupid>                         <artifactid>ant-contrib</artifactid>                         <version>20020829</version>                     </dependency>                 </dependencies>                 <executions>                     <execution>                         <id>initialize</id>                         <phase>initialize</phase>                         <configuration>                             <tasks>                                 <taskdef resource="net/sf/antcontrib/antcontrib.properties" />                                  <echo message="${dir.name}"/>                                 <echo message="${uninstaller.filename}"/>                                 <if>                                     <available file="${dir.name}/${uninstaller.filename}"/>                                     <then>                                         <echo>!!!!!!!!!!!!!!! ok </echo>                                     </then>                                     <else>                                         <echo>!!!!!!!!!!!!!!!! not found</echo>                                     </else>                                 </if>                             </tasks>                         </configuration>                         <goals>                             <goal>run</goal>                         </goals>                     </execution>                 </executions>             </plugin>         </plugins>     </build>  </project> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -