Is there a way to copy all maven referenced jars to the war/WEB-INF/lib

3,244 views
Skip to first unread message

Mike.G

unread,
Jan 30, 2011, 4:01:05 AM1/30/11
to google-we...@googlegroups.com
hi all:
 i'm using maven to organize my gwt project, everything works well but one defect: Is there a way to copy all maven referenced jars to the war/WEB-INF/lib?

when i use maven POM to add a new depencies, i have to copy the jar and it's dependent jar to WEB-INF/lib, usually i may forget copying some, which will lead to "no class def" error when i deliver the project to web server. but in development mode, it works well.

could someone help me? how did you tackle this messy situation? thanks very much.


Bálint Kriván

unread,
Jan 30, 2011, 5:54:19 AM1/30/11
to google-we...@googlegroups.com
Did you run, mvn eclipse:eclipse? It should add the maven jars to the classpath, and used by Eclipse.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Üdv,
Kriván Bálint

Mike.G

unread,
Jan 30, 2011, 6:49:20 AM1/30/11
to google-we...@googlegroups.com
i search the net and found http://stackoverflow.com/questions/97640/force-maven2-to-copy-dependencies-into-target-lib 

i type the below 
<project>
...
   
<profiles>
       
<profile>
           
<id>qa</id>
           
<build>
               
<plugins>
                   
<plugin>
                       
<artifactId>maven-dependency-plugin</artifactId>
                           
<executions>
                               
<execution>
                                   
<phase>install</phase>
                                   
<goals>
                                       
<goal>copy-dependencies</goal>
                                   
</goals>
                                   
<configuration>
                                       
<outputDirectory>${project.build.directory}/lib</outputDirectory>
                                   
</configuration>
                               
</execution>
                           
</executions>
                   
</plugin>
               
</plugins>
           
</build>
       
</profile>
   
</profiles>
</project>

but seems does not work, i don't know where is the mistake.
by the way, i use m2eclipse

Thomas Broyer

unread,
Jan 30, 2011, 7:04:14 AM1/30/11
to google-we...@googlegroups.com
If you use Eclipse to launch the DevMode, see the FAQ for the Google Plugin for Eclipse.

If you do not use Eclipse, I'd suggest you use the gwt-maven-plugin to launch the DevMode, it'll do what's necessary with your dependencies (I haven't used myself though, so I can't help)

Gabriel Guerrero

unread,
Jan 30, 2011, 9:39:23 AM1/30/11
to Google Web Toolkit
Hi , first you need configured the war to plugin to use war as
warSourceDirectory, after that use mvn war:inplace and that will copy
the libraries to your lib folders, check the maven war plugin web page
for more details, also I recommend to check the maven gwt puglin
website, they have examples of the best ways to setup your project and
what structure it must have

On Jan 30, 12:04 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> If you use Eclipse to launch the DevMode, see the FAQ for the Google Plugin
> for Eclipse <http://code.google.com/eclipse/docs/faq.html#gwt_with_maven>.

Ezequiel Palumbo

unread,
Jan 30, 2011, 11:51:10 AM1/30/11
to Google Web Toolkit
Hi Mike,

Does the problem occurs even if you execute the 'package' or 'install'
phase? Did you check the scope of those dependencies?
Very strange behaviour otherwise...

Salud!

Ezequiel.-

mortsahl

unread,
Jan 30, 2011, 12:02:37 PM1/30/11
to Google Web Toolkit
I'm new to GWT and trying to figure things out, but on this maven
question, I created my initial project using the included
webAppCreator script like this ...

$GWT_HOME/webAppCreator -out myProject -maven com.myProject

(I'm on a Mac so change your path accordingly)

This created my initial project template including the pom.xml file.
See the generated README.txt file. I then imported the project into
Eclipse using the m2eclipse plugin and importing as an existing maven
project. Build from the command line or from Eclipse.

This gives you a working template ... add dependencies, get rid of the
sample code and start doing your own thing. First thing I did was
just add a dependency and did a mvn clean gwt:compile package then
looked in the the generated war file's WEB-INF/lib and my dependency
was there.

Very easy. I don't know if I'll run into problems as my app grows in
complexity but for a start I couldn't be happier.

Mort

Bálint Kriván

unread,
Jan 31, 2011, 8:06:03 AM1/31/11
to google-we...@googlegroups.com
wow, webAppCreator support maven structure? Good news, thanks for the heads-up!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Üdv,
Kriván Bálint
Reply all
Reply to author
Forward
0 new messages