How to fix Not support in -source error

The specific error I was receiving while trying to run tests was,

annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations)

To solve this error, since I'm using maven as my build tool, I updated my pom.xml. Below is my full pom.xml.

The important part to fix the error was to add this section to the <build> section. It makes the source and target use version 1.6 instead of version 1.3.

<plugins>
        <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                </configuration>
        </plugin>
</plugins>

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>org.kuali.sage.dev.spring</groupId>
        <artifactId>Spring</artifactId>
        <packaging>war</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>Spring Maven Webapp</name>
        <url>http://maven.apache.org</url>
        <properties>
                <org.springframework.version>3.0.0.RELEASE</org.springframework.version>
                <org.slf4j.version>1.5.10</org.slf4j.version>
        </properties>
        <dependencies>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                        <scope>test</scope>
                </dependency>
                <!--  Spring -->
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context</artifactId>
                        <version>${org.springframework.version}</version>
                        <exclusions>
                                <!-- Exclude Commons Logging in favor of SLF4j -->
                                <exclusion>
                                        <groupId>commons-logging</groupId>
                                        <artifactId>commons-logging</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-webmvc</artifactId>
                        <version>${org.springframework.version}</version>
                </dependency>

                <!-- Logging -->
                <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.15</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>javax.mail</groupId>
                                        <artifactId>mail</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>javax.jms</groupId>
                                        <artifactId>jms</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>com.sun.jdmk</groupId>
                                        <artifactId>jmxtools</artifactId>
                                </exclusion>
                                <exclusion>
                                        <groupId>com.sun.jmx</groupId>
                                        <artifactId>jmxri</artifactId>
                                </exclusion>
                        </exclusions>
                        <scope>runtime</scope>
                </dependency>
                <!-- Servlet -->
                <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>
                <!--  URL Rewrite -->
                <dependency>
                        <groupId>org.tuckey</groupId>
                        <artifactId>urlrewritefilter</artifactId>
                        <version>3.1.0</version>
                </dependency>
        </dependencies>
        <build>
                <finalName>Spring</finalName>
                <plugins>
                        <plugin>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.6</source>
                                        <target>1.6</target>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
</project>
 

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.