geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dillon <ja...@planet57.com>
Subject Handling of LICENSE.txt and NOTICE.txt on trunk
Date Tue, 22 Aug 2006 05:54:28 GMT
I recently discovered that if a parent pom adds an antrun plugin  
execution to build, that children can not add dependencies, which  
causes some problems further down in the build.  I was going to use  
antrun to install LICENSE.txt and NOTICE.txt into target/classes/META- 
INF as a work around to the problem that occurs when we added them to  
build/resources that caused the maven-eclipse-plugin to barf.

So I finally gave up and create a new plugin which allows Groovy  
scripts to be executed inline and with the AntBuilder we can execute  
Ant bits, as well as perform logic operations all within a pom.  And  
I setup the project-config pom to add an execution that will copy  
LICENSE.txt and NOTICE.txt from the module root to target/classes/ 
META-INF for all modules unless the packaging is pom, with:

     <plugin>
         <groupId>org.apache.geronimo.genesis.plugins</groupId>
         <artifactId>script-maven-plugin</artifactId>
         <version>1.0.0-SNAPSHOT</version>
         <executions>
             <execution>
                 <id>install-licenses-and-notice</id>
                 <phase>generate-resources</phase>
                 <goals>
                     <goal>groovy</goal>
                 </goals>
                 <configuration>
                     <code>
                         if (project.packaging != "pom") {
                             def ant = new AntBuilder()

                             def dir = "${project.basedir}/target/ 
classes/META-INF"
                             ant.mkdir(dir: dir)
                             ant.copy(todir: dir) {
                                 fileset(dir: "${project.basedir}") {
                                     include(name: "LICENSE.txt")
                                     include(name: "NOTICE.txt")
                                 }
                             }
                         }
                     </code>
                 </configuration>
             </execution>
         </executions>
     </plugin>

The new script-maven-plugin is a tad different than the groovy-maven- 
plugin in the mojo sandbox, primarily allows the code for the script  
to be defined in the pom or at an external URL.  Also allows extra  
dependencies to be added outside of the normal Maven plugin  
dependency mechanism, since antrun has shown that it is broken for  
parent and child configurations.

There are still however a few issues remaining that prevent `mvn  
eclipse:eclipse` from generating clean .classpath files, which will  
be fixed when we move modules to use the standard m2 layout.

--jason

Mime
View raw message