I've been having a headache with maven. I already know how to transfer using the <outputDirectory>. but how do I set the other dirs such as webapp and resources? I want separate dirs for each of them. how do I do this? thanks
When you say "<outputDirectory>", which one are you talking about? There are many. Knowing which plugin you are using would be helpful.
What do you mean by "how do I set the other dirs such as webapp and resources"? Set them for what?
It might also help if you described what it is that you hope to accomplish. I suspect that you are wanting to use the Resource plugin to copy files from various locations, but if that is what you want to do, then given the locations you mentioned (webapps, resources) you are doing it wrong!
Sorry, perhaps I wasn't too clear. This is my config
I omit the dependencies part since they're too long and irrelevant to my question. when I use compile goal, the files are properly complied and moved to the expected dir. But I also have folder for layout, style, images and various other folders. I want maven to copy/replace these folders to different locations within /test. how do I do this. but please tell me about this plugin you mentioned. I don't see any plugin in my config. thanks
As I suspect, you are doing things fundamentally wrong:
a) Your Java source is in the wrong location (it should be in src/main/java)
b) I suspect that your static web files are also in the wrong location (they should be in src/main/webapp)
c) I suspect that you have the wrong packaging type (it should be "war")
d) You should never compile into a Tomcat directory. There are other plugins, such as Cargo, that will deploy apps for you.
Yes, I'm just getting started with maven. must I use war packaging? I prefer deploying it in folder structures (not packaged into one big war file) so if I need to replace a file, I don't need to send the entire war file to my client. Just the necessary files. Is this correct? thanks
Have you tried using war packaging? Have you noticed what Maven does when you do so? I am tempted to tell you, but I think that you need to try it for yourself. After you run the build (mvn package), closely examine the target directory and tell me what you see.
* a Maven build never modifies anything in the "src" directory.
* all "built" artifacts go into the "target" directory
* this does involve a lot of file copying, especially for static web resources, but it does facilitate filtering those static resources
* the "packaging" value describes not just the final artifact type, but also defines the directory structure and the steps used to build the project.