Static compile .groovy by default using maven -


i using maven compile .groovy in our project

my pom.xml is

        <plugin>             <artifactid>maven-compiler-plugin</artifactid>             <version>3.1</version>             <configuration>                 <source>1.6</source>                 <target>1.6</target>                 <encoding>utf-8</encoding>                 <compilerid>groovy-eclipse-compiler</compilerid>                 <verbose>true</verbose>                 <compilerarguments>                     <configscript>/tmp/aa.groovy</configscript>                 </compilerarguments>                 <fork>true</fork>             </configuration>             <dependencies>                 <dependency>                     <groupid>org.codehaus.groovy</groupid>                     <artifactid>groovy-eclipse-compiler</artifactid>                     <version>2.7.0-01</version>                 </dependency>                 <dependency>                     <groupid>org.codehaus.groovy</groupid>                     <artifactid>groovy-all</artifactid>                     <version>${groovy.version}</version>                 </dependency>             </dependencies>         </plugin> 

is there

http://groovy.codehaus.org/advanced+compiler+configuration

groovyc -configscript src/conf/config.groovy src/main/groovy/myclass.groovy

so can compile groovy in static way default

you may use ant

        <plugin>             <artifactid>maven-antrun-plugin</artifactid>             <executions>                 <execution>                     <id>compile</id>                     <phase>compile</phase>                     <configuration>                         <tasks>                             <mkdir dir="${basedir}/src/main/groovy"/>                             <taskdef name="groovyc" classname="org.codehaus.groovy.ant.groovyc">                                 <classpath refid="maven.compile.classpath"/>                             </taskdef>                             <mkdir dir="${project.build.outputdirectory}"/>                             <groovyc destdir="${project.build.outputdirectory}"                                       srcdir="${basedir}/src/main/groovy/"                                       listfiles="true"                                      configscript="${basedir}/src/config/config.groovy">                                 <classpath refid="maven.compile.classpath"/>                             </groovyc>                         </tasks>                     </configuration>                     <goals>                         <goal>run</goal>                     </goals>                 </execution>             </executions>         </plugin> 

and config.groovy

withconfig(configuration) {    ast(groovy.transform.compilestatic) } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -