Skip to content

Instantly share code, notes, and snippets.

@regis-leray
Last active August 29, 2015 14:15
Show Gist options
  • Save regis-leray/f704f987cad0264a98c7 to your computer and use it in GitHub Desktop.
Save regis-leray/f704f987cad0264a98c7 to your computer and use it in GitHub Desktop.
GMaven -
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
public void replace(srcExp,replaceText){
def currentDir = new File(project.basedir,"src/main/java");
def fileText;
//Replace the contents of the list below with the
//extensions to search for
def exts = ["WebMethodResult.java"]
currentDir.eachFileRecurse({file ->
for (ext in exts){
if (file.name.endsWith(ext)) {
fileText = file.text;
fileText = fileText.replaceAll(srcExp, replaceText)
file.write(fileText);
}
}
})
}
replace("public class WebMethodResult \\{","public class WebMethodResult implements IWebMethodResult \\{");
</source>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment