I am new to Maven. I have a directory structure like this
|--->WEB-INF----> classes---> class files & resource files
|-->btech-----> struts-config.xml & validation.xml
This structure should not be changed. Is there any way I could change the standard directory structure to my own structure? Please Suggest. If you can help me with a sample pom file for this directory structure. It would be great. Thanks in advance.
You can override maven's directory architecture, but there are 2 reasons why you shouldn't.
1. It's a lot of trouble. You have to go in an manually override all the locations in your POM.
2. It makes the project non-standard. One of Maven's big selling points is that anyone can start working on a Maven project fairly quickly, because they don't have to figure out where the various project components are located like they do with less strictly-organized systems like Ant's.
I'll admit that I'm not terribly in love with Maven's directory organization myself, but I've learned to live with it because of the advantages it brings.
Customer surveys are for companies who didn't pay proper attention to begin with.
Incidentally, you can keep your directory structure almost completely intact just by placing it in a WAR project's src/main/webapp directory. Since you're using Struts, however, you might want to move some of the resource definitions to src/main/resource where plugins can build the config information dynamically using the resources as models.
The only questionable thing I see in your POM is that appears you're choosing a source compile level of 1.2, and Java 1.2 is so ancient, I'd recommend going to at least 1.4. But that wouldn't cause this problem.
If you haven't looked at the docs for the Maven WAR plug-in, you should do so, since they describe the differences between a generic Maven project structure and a WAR project.
Here are some things to note, however:
1. src/main/webapp contains an image of the static parts of your WAR, from its root on down. It doesn't contain the WAR root directory itself, however. In other words, if your app is named "myapp", it's not src/main/webapp/myapp/WEB-INF, it's src/main/webapp/WEB-INF. And if I said src/main/resources, I'm sorry. My memory is a dangerous thing to trust.
2. Note that I said static resources. Don't compile classes and put them into src/main/webapp/WEB-INF/classes unless they're externally compiled library resources. Maven will compile your project's sources and put them in the final WAR (target/myapp). In most cases, if you have a src/main/webapp/WEB-INF/classes directory at all, it will only have static configuration files like the log4 properties file in it, not class files.
The more complicated you've made things, the more likely you're doing something you shouldn't. Maven expects to be able to do all the basic WAR-building functions itself with minimal outside help.
Joined: Nov 23, 2009
I have done in the same way you have mentioned, but the problem still exists.
Struts, validation xmls are created twice in WEB-INF/classes/src/main/webapp/WEB-INF/Iyear and WEB-INF/Iyear folders.
The folder structure I have created is as in the attached image.
Joined: Nov 23, 2009
Sorry Tim I have referred you as Tom in last message.