On 6/5/07, Bruno Waes <[EMAIL PROTECTED]> wrote:

I want to keep my webapp (created with "mvn archetype:create
-DarchetypeArtifactId=maven-archetype-
webapp") as clean as possible and only have Spring config files,
Freemarker templates, web.xml ... files there, and no actual code.



Ok, i actually found out how to do it after a few more hours digging into
it.

First of all in my assembly file i got rid of the id-tag

<assembly>
   <formats>
       <format>zip</format>
   </formats>
       <includeBaseDirectory>false</includeBaseDirectory>
   <fileSets>
       <fileSet>
           <directory>/target/projectname-1.0-SNAPSHOT</directory>
           <outputDirectory>/</outputDirectory>
       </fileSet>
   </fileSets>
</assembly>

the id tag was showing up in the filename in the repo
${artifactId}-${version}-${Id}.zip , so just removing the <id> tag resulted
in a nice clean zip, with the same basename as the jar in my repo.

So i got it in my repository, now i have to get it out in my webapp project.
Therefor i added this plugin to the plugins section of the build section of
my webapp pom.xml file:

           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>dependency-maven-plugin</artifactId>
               <executions>
                   <execution>
                       <id>unzip-gwt</id>
                       <phase>generate-resources</phase>
                       <goals>
                           <goal>unpack</goal>
                       </goals>
                       <configuration>
                           <artifactItems>
                               <artifactItem>
                                   <groupId>my.group.id</groupId>
                                   <artifactId>myprojectgwt</artifactId>
                                   <version>1.0-SNAPSHOT</version>
                                   <type>zip</type>
                               </artifactItem>
                           </artifactItems>
                           <outputDirectory>
                               ${project.build.directory}/${project.name
}</outputDirectory>
                       </configuration>
                   </execution>
               </executions>
           </plugin>


The groupId, artifactId and version are just the same as i use in the
dependencies section, to include my jar, the type-tag lets it take the zip
instead.

So thats it.
With a "mvn install" in my gwt project, two artifacts get uploaded into my
REPO, the jar file with the classes, and the zip with the GWTCompile output
(the html and the js files)

In my webapp project the jar is added as a dependency and the zip is fetched
and unziped into my target directory and included when the war package is
build.


Thought i d post the result on the list because i think its a nice and clean
way to integrate your GWTCompiled output in your webapp.

Bruno

Reply via email to