eclipse - Check war file before deploy / conditional deploy -


when using cargo deploy remote server check cargo or maven generated war have it's properties files filtered expected.

some phase in between should test property file war against strings , deploy or stop deployment.

there's built in on cargo achieve this?

not sure properties files you're referring therefore assume refer typical java *.properties files.

anyway, believe should use: maven-enforcer-plugin , it's goal: enforce common way in maven enforce condition (the plugin uses term: rule) fulfilled.

i think have more options here.

option 1

maybe check prio packaging war using:

maven-property-plugin - goal: read-project-properties (http://mojo.codehaus.org/properties-maven-plugin/usage.html)

  <plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>properties-maven-plugin</artifactid>     <version>1.0-alpha-2</version>     <executions>       <execution>         <phase>???</phase>         <goals>           <goal>read-project-properties</goal>         </goals>         <configuration>           <files>             <file>your_file_to_check.properties</file>           </files>         </configuration>       </execution>     </executions>   </plugin> 

where should:

and afterwards go maven-enforcer-plugin goal: enforce , rule: requireproperty (http://maven.apache.org/enforcer/enforcer-rules/requireproperty.html)

  <plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-enforcer-plugin</artifactid>     <version>1.3.1</version>     <executions>       <execution>         <id>enforce-property</id>         <goals>           <goal>enforce</goal>         </goals>         <configuration>           <rules>             <requireproperty>               <property>your_property_to_check</property>               <message>you must set your_property_to_check property!</message>               <regex>regex</regex>               <regexmessage>violation txt</regexmessage>             </requireproperty>                          </rules>           <fail>true</fail>         </configuration>       </execution>     </executions>   </plugin> 

where:

  • your_property_to_check should replaced real 1 as
  • regex should defined

option 2

if not feasible , want check property inside war file, might need write own rule.

that should not big deal java has zip reading properties files loading in it's standard api. learn how write custom rule, see: http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html

btw. i'd quite curious understand why want check property on each deployment? case input (property files filter) dynamically generated/changed? otherwise doubt need once check works.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -