通过Maven更新项目配置后的错误消息

时间:2011-12-06 09:52:36

标签: java maven maven-3 sts-springsourcetoolsuite

我正在使用Maven开发一个项目。过了一会儿,我在IDE(Springsource Tool Suite)中“更新了项目配置”。现在我的IDE抱怨,有一些错误,以前没有在这里。 奇怪的是,错误消息似乎是错误的。在下面的代码中,它说,我必须删除@override Annotation,因为必须覆盖超类(我实际上在做什么?)

 package org.powertac.humanbroker.services;

        import javax.jms.JMSException;
        import javax.jms.Message;
        import javax.jms.MessageListener;
        import javax.jms.TextMessage;            
        import org.slf4j.Logger;
        import org.slf4j.LoggerFactory;

    public class JMSMessageListenerDecorator  implements MessageListener{

        private static final Logger Log =     LoggerFactory.getLogger(JMSMessageListenerDecorator.class);
        private BaseMessageListener messageListener = null;

        public JMSMessageListenerDecorator(BaseMessageListener l){
            messageListener = l;
        }

        @Override
        public void onMessage(Message message) {

            if (message instanceof TextMessage) {
                try {                               
                    if(Log.isDebugEnabled())
                        Log.debug("Received message "+ message.toString()+" from JMS.");

                    messageListener.onMessage(((TextMessage) message).getText());
                } catch (Exception e){ 
                    Log.error ("The original message leading up to the exception reads ${message.text}.", e);
                }
            } else {
                Log.error ("The JMS Listener knows only how to react to TextMessage objects.");
            }

        }

    }

error message

任何想法我能做什么使错误消息消失? THX

PS:我在3个不同的类中得到了大约5条错误消息,所有人都抱怨@Override Annotation。


更新

我的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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>xyz</artifactId>
  <name>xyz</name>
  <description>xyz</description>
  <repositories>
      <repository>  
        <id>prime-repo</id>  
        <name>PrimeFaces Maven Repository</name>  
        <url>http://repository.primefaces.org</url>  
        <layout>default</layout>  
    </repository>  
  </repositories>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>${springwebflow-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <!-- Communication to  Server -->

      <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
      <version>1.4.1</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>javax.jms</groupId>
    <artifactId>jms-api</artifactId>
    <version>1.1-rev-1</version>
</dependency>
<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-all</artifactId>
    <version>5.5.1</version>
</dependency>
<dependency>
    <groupId>activecluster</groupId>
    <artifactId>activecluster</artifactId>
    <version>20040423.075722</version>
</dependency>
<dependency>
    <groupId>xmlbeans</groupId>
    <artifactId>xbean</artifactId>
    <version>2.0.0</version>
</dependency>
<dependency>
    <groupId>javacc</groupId>
    <artifactId>javacc</artifactId>
    <version>4.0</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jms</artifactId>
    <version>3.0.6.RELEASE</version>
</dependency>
<dependency>
    <groupId>commons-httpclient</groupId>
    <artifactId>commons-httpclient</artifactId>
    <version>3.1</version>
</dependency>
<dependency>
    <groupId>org.jboss.spec.javax.ws.rs</groupId>
    <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
    <version>1.0.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jdom</groupId>
    <artifactId>jdom</artifactId>
    <version>1.1.2</version>
</dependency>
<dependency>
    <groupId>jaxen</groupId>
    <artifactId>jaxen</artifactId>
    <version>1.1.3</version>
    <!-- http://jira.codehaus.org/browse/JAXEN-217 -->
    <exclusions>
      <exclusion>
        <groupId>maven-plugins</groupId>
        <artifactId>maven-cobertura-plugin</artifactId>
      </exclusion>
      <exclusion>
        <groupId>maven-plugins</groupId>
        <artifactId>maven-findbugs-plugin</artifactId>
      </exclusion>
    </exclusions>
</dependency>


    <!-- Sun Mojarra JSF 2 runtime -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.0.3</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.0.3</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.2.GA</version>
    </dependency>
      <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
       <version>3.3.2.GA</version>
    </dependency>
    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-annotations</artifactId>
       <version>3.4.0.GA</version>
    </dependency>
    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-commons-annotations</artifactId>
       <version>3.3.0.ga</version>
    </dependency>
    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-entitymanager</artifactId>
       <version>3.4.0.GA</version>
    </dependency> 
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.ejb</groupId>
        <artifactId>ejb-api</artifactId>
        <version>3.0</version>
    </dependency>
        <!-- PrimeFaces component library -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.powertac</groupId>
        <artifactId>server-interface</artifactId>
        <version>0.1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
  <reporting>
  <plugins>
  <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.5.1</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.3.3</version>
      </plugin>
      <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>
  </plugins>
  </reporting>
  <packaging>war</packaging>
  <properties>
    <springframework-version>3.0.5.RELEASE</springframework-version>
    <springwebflow-version>2.3.0.RELEASE</springwebflow-version>
    <springsecurity-version>3.0.3.RELEASE</springsecurity-version>
    <org.slf4j-version>1.5.10</org.slf4j-version>
  </properties>
  <groupId>org.powertac</groupId>
  <version>0.0.1-SNAPSHOT</version>
</project>

1 个答案:

答案 0 :(得分:2)

在你的pom.xml中,你需要这样的东西:

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

您当前的pom.xml可能正在为Java 5配置您的项目(可能是默认情况下),您正在使用Java 6的语言语义。如果您将所有内容配置为Java 6,则应该全部设置。