It may sound silly to people here, but I really need some light on this topic.
Generally in a web project we build the project in an EAR and deploy it in the server. Few questions which I have in mind:
1. Can have multiple sub projects under one main project in J2EE web project. If so how? Of course we create our own projects and merge in into one place, i.e in one project. But this is tedious and can lead to mismatches if multiple people are involved
2. Can we have multiple ears for the one project. Why this question came is because, in the first question if we go for multiple projects without merging then surely we have to have a main project ear and to that ear the sub project's ear should talk.
Is this possible? I mean I really don't know. But the reasons these questions came up is somebody asked me a question today, which was valid from my point of view. He asked me, in a large project, can we give patches(bug fixes) without building the entire project, but rather giving the modified files only.
1) You can have different folders, but only one war/web project inside your web project. You can create multiple web projects; which creates multiple wars; within the same ear and this is a good approach. It keeps the "sub-parts" independent.
2) You can have multiple ears, but then they are multiple applications and not really one project.
And welcome to JavaRanch!
Joined: Jun 03, 2010
I was breaking my head on this. As you said its true that if we keep multiple wars it will be multiple application, so there is no scope for this solution atleast in my scenario.
The next you suggested is to have multiple folders in one war. This seems to be a good idea, and i was having my hands dirty on this from past few days. What I did is we can have multiple projects and one main project. The required classes and other files we can copy it in the main project and create a war of the main project and deploy it. And this copy and creation of war can be done via an ant script.
But the problem what I feel will come is at the time of development if there is any dependency of one module to another. But for this I think we can maintain dependency file which can be an xml or properties file and we can read it in the build.xml and copy teh dependent files from the dependent modules to the existing module. For this also we need to write an ANT script.
Now I have to write this ANT script and really I haven't written any ANT script. So most probably will be posting question in the ANT forum