【问题标题】:Deployment Assembly in EclipseEclipse 中的部署程序集
【发布时间】:2013-02-04 20:23:13
【问题描述】:
  • Eclipse 靛蓝。
  • M2Eclipse 插件。
  • 雄猫 7.
  • Spring 框架。

尝试使用“部署程序集”选项,以便我的 Eclipse 项目的 Maven 依赖项自动添加到 Tomcat。

这是我的 pom.xml 文件的一部分:

...
<packaging>war</packaging>
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.9.Final</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
</dependencies>
...

我做项目属性 -> 部署程序集 -> 添加 -> Java 构建路径条目 -> Maven 依赖项。

当我尝试将我的项目添加到 Eclipse 中的 Tomcat 服务器时,我得到:

如您所见,只有 spring-web 依赖项被添加到我的项目中,因此出现以下部署错误。

SEVERE: Error configuring application listener of class  org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

有什么想法吗?

【问题讨论】:

    标签: spring maven m2eclipse


    【解决方案1】:

    尝试为 WTP 安装 Maven 集成,即 m2e-wtp https://www.eclipse.org/m2e-wtp/

    它会自动将 Maven 类路径库添加到部署程序集,并尊重每个单独的类路径条目的 maven 范围(即部署 compileruntime 依赖项,而不是 testprovided

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-07
      • 2016-06-06
      • 2012-01-14
      • 2012-07-21
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      相关资源
      最近更新 更多