xml - Variable substitution in Maven -


i'm new maven , i'm trying change content of field based on entry provided in command line using variable.

i have following xml file called weatherxml.xml in directory apiproxy:

<apiproxy name="weatherxml">?     <configurationversion majorversion="4" minorversion="0"/>     <createdat>1453818052</createdat>     <description>${description}</description>     <displayname>weatherxml</displayname>     <validate>true</validate> </apiproxy> 

and in pom.xml file have piece of code:

<resources>   <resource>     <directory>apiproxy</directory>     <filtering>true</filtering>   </resource> </resources>        

this test profile used building

<profile>   <id>test</id>   <properties>     <apigee.profile>test</apigee.profile>     <apigee.env>${api_environment}</apigee.env>     <apigee.hosturl>${api_hosturl}</apigee.hosturl>     <apigee.apiversion>v1</apigee.apiversion> <!-- value of version in  https://api.enterprise.apigee.com/v2 -->     <apigee.org>${api_organization}</apigee.org>     <apigee.username>${username}</apigee.username>     <apigee.password>${password}</apigee.password>     <apigee.options>override</apigee.options>     <apickli.env>.test</apickli.env>   </properties> </profile> 

if invoke maven using

mvn resources:resources -ddescription="test description"  

it creates target directory , can see change has been made. however, if invoke

mvn install -ptest -dusername=xxx -dpassword=yyy -dhost=www.aaa.com -ddescription="test description"  

it builds , deploys code description field contains "${description}" text instead of "test description".

how variable substitution in deployed code? don't know if related use of plugins, maybe of them overrides it.

<build>      <resources>       <resource>         <directory>apiproxy</directory>         <filtering>true</filtering>       </resource>     </resources>      <pluginmanagement>         <plugins>             <plugin>                 <groupid>io.apigee.build-tools.enterprise4g</groupid>                 <artifactid>apigee-edge-maven-plugin</artifactid>                 <version>1.0.0</version>             </plugin>         </plugins>     </pluginmanagement>           <plugin>             <artifactid>maven-resources-plugin</artifactid>             <version>2.6</version>             <executions>                   <!--copy full apiproxy folder target folder -->                 <execution>                     <id>copy-apiproxy-resources</id>                     <phase>package</phase>                     <goals>                         <goal>copy-resources</goal>                     </goals>                     <configuration>                          <!--this important -->                         <overwrite>true</overwrite>                          <!--target -->                         <outputdirectory>${target.root.dir}/apiproxy</outputdirectory>                         <resources>                             <resource>                                  <!--source -->                                 <directory>${project.root.dir}/apiproxy</directory>                             </resource>                         </resources>                                                 </configuration>                 </execution>             </executions>         </plugin>          <plugin>             <groupid>io.apigee.build-tools.enterprise4g</groupid>             <artifactid>apigee-edge-maven-plugin</artifactid>             <configuration>                  <!--use module level config skip module build. make true -->                 <skip>false</skip>              </configuration>             <executions>                 <execution>                     <id>configure-bundle-step</id>                     <phase>package</phase>                     <goals>                         <goal>configure</goal>                     </goals>                 </execution>                  <!--deploy bundle -->                 <execution>                     <id>deploy-bundle-step</id>                     <phase>install</phase>                     <goals>                         <goal>deploy</goal>                     </goals>                 </execution>             </executions>         </plugin>         <!-- cleaning dirs -->         <plugin>             <artifactid>maven-clean-plugin</artifactid>             <version>2.5</version>              <executions>                 <execution>                     <id>auto-clean-init</id>                     <phase>initialize</phase>                     <goals>                         <goal>clean</goal>                     </goals>                 </execution>                 <execution>                     <id>auto-clean-install</id>                     <phase>install</phase>                     <goals>                         <goal>clean</goal>                     </goals>                 </execution>             </executions>         </plugin>          <!-- run cucumber / apickli tests -->         <plugin>             <groupid>org.codehaus.mojo</groupid>             <artifactid>exec-maven-plugin</artifactid>             <version>1.3.2</version>             <executions>                 <!-- run integration tests -->                 <execution>                     <id>integration</id>                     <phase>install</phase>                     <goals>                         <goal>exec</goal>                     </goals>                     <configuration>                         <environmentvariables>                             <node_env>                                 ${apigee.env}                             </node_env>                         </environmentvariables>                         <executable>cucumber-js</executable>                         <commandlineargs>                             tests/integration${apickli.env} --format json:cucumber-result.json                         </commandlineargs>                     </configuration>                 </execution>             </executions>         </plugin>      </plugins> </build> 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -