I've implemented another solution, this time not dragging all of the
classes that Groovy needs into the classloader, which appears to have
caused the car plugin to freak out.

I added a new mojo to the tools-maven-plugin, 'copy-legal-files' that
is very specific and only handles the copy of the LICENSE.txt and
NOTICE.txt files for inclusion into archives, as in:

   <plugin>
       <groupId>org.apache.geronimo.genesis.plugins</groupId>
       <artifactId>tools-maven-plugin</artifactId>
       <version>1.0.0-SNAPSHOT</version>
       <executions>
           <execution>
               <id>install-legal-files</id>
               <phase>generate-resources</phase>
               <goals>
                   <goal>copy-legal-files</goal>
               </goals>
           </execution>
       </executions>
   </plugin>

I have also cleaned up the remaining (I think) resource includes that
were causing the Eclipse plugin to generate bunk .classpath files.  If
someone want to give it a whirl and let me know if Eclipse complains
about any overlapping directories...

--jason


On 8/21/06, Jason Dillon <[EMAIL PROTECTED]> wrote:
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

Reply via email to