Maven项目没有将/ target / classes和/ target / monitoring / WEB-INF / classes视为classpath root

时间:2013-04-25 13:18:45

标签: eclipse maven

我有Spring + JSF2 + Hibernate的Maven项目,应该部署到Tomcat 7。

构建和部署后,我得到以下异常:

GRAVE: Unable to load annotated class: target.classes.com.barcelo.monapp.web.controller.MonitoringBean, reason: java.lang.NoClassDefFoundError: target/classes/com/barcelo/monapp/web/controller/MonitoringBean (wrong name: com/barcelo/monapp/web/controller/MonitoringBean)
GRAVE: Unable to load annotated class: target.monitoring.WEB-INF.classes.com.barcelo.monapp.web.controller.MonitoringBean, reason: java.lang.NoClassDefFoundError: target/monitoring/WEB-INF/classes/com/barcelo/monapp/web/controller/MonitoringBean (wrong name: com/barcelo/monapp/web/controller/MonitoringBean)

/target/classes/target/monitoring/WEB-INF/classes不属于那里。

这是我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>com.barcelo.monapp</groupId>
        <artifactId>monapp-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../monapp-parent/pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>monapp-web</artifactId>
    <packaging>war</packaging>
    <name>monapp-web</name>
    <url>http://maven.apache.org</url>

    <dependencies>

        <!-- monitoring client -->
        <dependency>
            <groupId>com.barcelo.monapp</groupId>
            <artifactId>monapp-client</artifactId>
            <version>1.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- monitoring service -->
        <dependency>
            <groupId>com.barcelo.monapp</groupId>
            <artifactId>monapp-service</artifactId>
            <version>1.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- monitoring data -->
        <dependency>
            <groupId>com.barcelo.monapp</groupId>
            <artifactId>monapp-data</artifactId>
            <version>1.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.1.3.RELEASE</version>
        </dependency>

        <!-- JSF -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- EL -->
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
        </dependency>


    </dependencies>

    <build>
        <finalName>monitoring</finalName>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

这是如何引起的?如何解决?

0 个答案:

没有答案