Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property autocapitalization in maven

Tags:

maven

I have a maven project that requires a property to be set at the command line(-Dmy.property=val). What I need to do is to convert that string into all caps since that property is used for string replacement in a number of files through the maven-resources-plugin. What's the simplest way to do this?

like image 664
Quantum_Entanglement Avatar asked May 09 '12 18:05

Quantum_Entanglement


1 Answers

The groovy plugin could be used. The following configures it to run at the beginning of the Maven build process:

        <plugin>
            <groupId>org.codehaus.groovy.maven</groupId>
            <artifactId>gmaven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>execute</goal>
                  </goals>
                   <configuration>
                      <source>
                      import org.apache.commons.lang.StringUtils

                      project.properties["my.property"] = StringUtils.upperCase(project.properties["my.property"]) 
                     </source>
                 </configuration>
             </execution>
          </executions>
     </plugin>
like image 121
Mark O'Connor Avatar answered Sep 28 '22 06:09

Mark O'Connor