Using maven for a dynamic web project

五迷三道 提交于 2019-12-20 06:36:37

问题


I'm newbie to maven and i'm used to create dynamic web project in eclipse with traditionnal jars.
I downloaded maven and installed it on my Windows8 system as indicated on the documentation and as listed on Kepler doc too you don't have to install any maven plugin on eclipse because it's already installed.
so when i test it by adding some dependecies like Hibernate it's ok it works until i added the Struts2 & Sitemesh framework when i was forced to add the jars to the lib folder to make it run . Is tehre any special configuration to do for that?


回答1:


I think you have a problem in deployment assembly management under eclipse, try:

  1. Open the project's properties (e.g., right-click on the project's name in the project explorer and select "Properties").
  2. Select "Deployment Assembly".
  3. Click the "Add..." button on the right margin.
  4. Click the "Add..." button on the right margin. 5.Select "Java Build Path Entries" from the menu of Directive Type and click "Next".
  5. Select "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".



回答2:


First you need to add Struts2 and test it if it works, then try to add Sightmeth and/or Hibernate plugins. See how to Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application.

The pom.xml for core struts2 application requires only

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>X.X.X.X</version>
</dependency>

and it will download all other dependencies. Integrating with other frameworks use plugins and don't mess up dependencies that are duplicated.



来源:https://stackoverflow.com/questions/25062089/using-maven-for-a-dynamic-web-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!