This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven : How can i add folders and jars files in generated war ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven : How can i add folders and jars files in generated war ?" Watch "Maven : How can i add folders and jars files in generated war ?" New topic

Maven : How can i add folders and jars files in generated war ?

pierre laurent

Joined: Aug 13, 2013
Posts: 2
Hi guys,

I did have a GWT RequestFactory project ( hibernate, spring).
Eclipse Kepler Release is used.

It was time for me to push the work onto a Tomcat Server 6 but i had a couple of problems as follows.


1) mapping files ( folder and (**not added in the war**)

2) I understood that some jars cannot be found on maven repository, marked as provided. Thus, i did the necessary to add them to the local repository manually. (**Not added in the war**)

3) A (locate on file was present in the right directory but was missing after deploying the war. (**not added in the war**)

4) Last goal : when deploying the project (previous cases being fixed), it says 404 error.
In fact, it should open app.html file but seems to be impossible even if the following is added to configuration maven file. (`<runTarget>app.html</runTarget>`)


I did add those to my project and everything is working fine.
I must confess i'm problably using maven the worst way but it is convenient to me because i can clean/install my project without opening Eclipse to generate a war that i can upload directly through Tomcat Manager and everybody can get the project and run it afterwards without getting stucked at every corner.

I do apologize if those are dumb questions but even if i read other threads, i wasn't able to understand what to do.
May someone guide on how to add those files on the war ? (a light version of my pom.xml is added)

Kind regards,


pierre laurent

Joined: Aug 13, 2013
Posts: 2
Last point resolved. Following was missing in web.xml.
Stupid mistake.


Still looking for the rest.
Peter Johnson

Joined: May 14, 2008
Posts: 5836

1) Not sure exactly what you mean by mapping files, but non-java files (config files, etc.) that you expect to be packaged in your artifact should be placed in src/main/resource using the exact directory structure you want (e.g. src/main/resources/com/xxx/persistence/mapping). Note that only *.java files should appear in src/main/java!

2) Placing JARs not available in Maven Central into your local repository is an acceptable solution (another is to locate the repository those JARS are available in an configure that repository, an another is to use a repository manager such as Nexus and place such JARs in there). You also need to reference those JARs in the dependencies in your POM, then they should end up in the WEB-INF/lib directory in your WAR.

3) See point #1 (by the way saying things like "was present in the right directory" are meaningless - if it would have been in the right directory it would have appeared in the WAR file. It would be better if you would have provided the exact location of the file relative to you project's base directory; then we could have told you where the file should have been located)

4) I see you fixed this already, thank you for posting the solution.

JBoss In Action
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Maven : How can i add folders and jars files in generated war ?