Obtaining Web Module Deployment Descriptor path from maven pom.xml
Hi,
I have a web application MY_WEBAPP that uses maven. I am able to open the maven pom.xml from IDEA 10.0.3 and locally start Tomcat from within IDEA to run this web application, after performing the following configuration steps:
- Open the "Project Structure" in IDEA (STRG+ALT+UMSCH+S)
- Select "Project" on the left hand side and check if the Project SDK is set properly. If not push "New" and select your C:\Tools\jdk1.6.0_16 directory as the JSDK home
- Click on "Facets", chose "Web"
- Click on the plus to add a new Facet
- Choose module "MY_WEBAPP"
- For the Web Module Deployment Descriptor, choose "c:\...MY_WEBAPP\src\main\webapp\WEB-INF\web.xml"
- For the Web Resource Directory, set C:\...MY_WEBAPP\src\main\webapp
- Click on "Add Application Server specific descriptor", choose Tomcat and set "C:\...MY_WEBAPP\src\main\webapp\META-INF\context.xml" as the path
- Click on "Fix" to add the facet to a new artifact
- Set the Output directory to "C:\...MY_WEBAPP\exploded"
- Click on "Fix", then "Add all missing dependencies..."
- Click on "Fix", then on "Add Maven-backport..."
Every time I check out a branch of my web application and want to open that branch in IDEA, I have to perform the above steps again. This is very tedious. I now tried providing the "Web Module Deployment Descriptor" by specifying, in my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
...
<webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
I also tried
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
however, IDEA by default keeps setting the Web Module Deployment Descriptor to C:\...MY_WEBAPP\web\WEB-INF\web.xml, so I still have to do the manual configuration whenever I try to open a new branch in IDEA.
Is there any way around this problem *except* by adding the IDEA project files to my repository/branches?
Thank you very much!
请先登录再写评论。