为什么我的Java Resources目录中有一个红色x?

时间:2015-03-24 11:02:17

标签: java eclipse spring maven

我在eclipse 4.4.2中使用maven创建了一个web项目,我的spring版本是3.2.7.RELEASE,我可以在tomcat 7中顺利运行项目,但是,我的Java Resources目录中有一个红色x,并且我无法发现任何错误。 我的项目树: my project tree

我的Java Build Path conf: Java Build Path conf

我的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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.alex</groupId>
  <artifactId>mywebapp</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mywebapp Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring.version}</version>
    </dependency>
  </dependencies>   
  <properties>
    <spring.version>3.2.7.RELEASE</spring.version>
  </properties>
  <build>
    <finalName>mywebapp</finalName>
  </build>
</project>

我的applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">

    <context:component-scan base-package="com.alex.mywebapp" />

    <bean id="helloWorldService" class="com.alex.mywebapp.HelloWorldService">
        <property name="name" value="Alex" />
    </bean>
</beans>

我的控制台没有问题,有人有想法吗?

提前谢谢你!

1 个答案:

答案 0 :(得分:1)

就像FMC所说, Markers选项卡会告诉你警告和错误及其描述。有时,此错误与项目方面相关联。属性&gt;项目方面&gt;动态Web模块(取消选中)和Java (更改为在pom中安装或设置的内容)的&GT;确定