|
I'm running Eclipse and Maven on a Mac. Here's my version of Maven
$ mvn -version Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100) Java version: 1.6.0_22 Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac"What I'm trying to do is use Maven to compile my Spring project so I can deploy the packaged war to a Tomcat. I setup my pom.xml (see below) and asked mvn to create the package. The build failed with the following error: Compilation failure /path/to/WelcomeController.java:[7,1] annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) @ControllerDoing mvn compile gives the same error. Google showed me that the 1.3-compiler-as-default was a known problem with Maven and I was happy to find a fix explained here: http://maven.apache.org/plugins/maven-compiler-plugin/howto.html But it's still not working ): In desperation I followed these instructions: http://pwong-tipsandtricks.blogspot.com/2009/02/install-and-test-maven-on-centos-52.html and put a fresh maven on my Linux box. The build failed with the same error, so it seems that my pom.xml is the culprit. But how? Here's the pom. Any ideas welcome!
<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>net.fnarg.twotrack</groupId>
<artifactId>twotrack-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Twotrack Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
<appName>twotrack</appName>
<tomcatPackageName>apache-tomcat-twotrack</tomcatPackageName>
<runas.username>twotrack</runas.username>
<runas.group>twotrack</runas.group>
</properties>
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle
Releases</name>
<url>http://repository.springsource.com/maven/bundles/milestone</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle
Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>com.springsource.org.apache.taglibs.standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</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>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<finalName>twotrack</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
|
|
What kind of error do you have once you set the source and target parameter
of the maven compiler plugin to 1.5 ? Jeff On Sun, Apr 17, 2011 at 6:55 PM, snowb0y <[hidden email]> wrote: > I'm running Eclipse and Maven on a Mac. Here's my version of Maven > > > $ mvn -version > Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100) > Java version: 1.6.0_22 > Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home > Default locale: en_US, platform encoding: MacRoman > OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac" > > > What I'm trying to do is use Maven to compile my Spring project so I can > deploy the packaged war to a Tomcat. I setup my pom.xml (see below) and > asked mvn to create the package. The build failed with the following error: > > > Compilation failure > /path/to/WelcomeController.java:[7,1] annotations are not supported in > -source 1.3 > (use -source 5 or higher to enable annotations) > @Controller > > > Doing mvn compile gives the same error. Google showed me that the > 1.3-compiler-as-default was a known problem with Maven and I was happy to > find a fix explained here: > > http://maven.apache.org/plugins/maven-compiler-plugin/howto.html > http://maven.apache.org/plugins/maven-compiler-plugin/howto.html > > > But it's still not working ): In desperation I followed these instructions: > > > > http://pwong-tipsandtricks.blogspot.com/2009/02/install-and-test-maven-on-centos-52.html > > http://pwong-tipsandtricks.blogspot.com/2009/02/install-and-test-maven-on-centos-52.html > and put a fresh maven on my Linux box. The build failed with the same > error, > so it seems that my pom.xml is the culprit. But how? Here's the pom. Any > ideas welcome! > > > > > 4.0.0 > net.fnarg.twotrack > twotrack-webapp > war > 1.0-SNAPSHOT > Twotrack Webapp > http://maven.apache.org > > > 3.0.5.RELEASE > twotrack > apache-tomcat-twotrack > twotrack > twotrack > > > > > com.springsource.repository.bundles.release > SpringSource Enterprise Bundle Repository - SpringSource Bundle > Releases > http://repository.springsource.com/maven/bundles/milestone > > > com.springsource.repository.bundles.external > SpringSource Enterprise Bundle Repository - External Bundle > Releases > http://repository.springsource.com/maven/bundles/external > > > > > > javax.servlet > jstl > 1.2 > > > javax.el > el-api > 1.0 > provided > > > org.apache.taglibs > com.springsource.org.apache.taglibs.standard > 1.1.2 > > > javax.servlet > servlet-api > 2.5 > provided > > > org.springframework > spring-context > ${spring.version} > > > org.springframework > spring-web > ${spring.version} > > > org.springframework > spring-webmvc > ${spring.version} > > > junit > junit > 3.8.1 > test > > > > > > > org.apache.maven.plugins > maven-eclipse-plugin > > 1.6 > 1.6 > > > > twotrack > > > src/main/resources > true > > > src/main/webapp > true > > > > > > > > > -- > View this message in context: > http://maven.40175.n5.nabble.com/Maven-refusing-to-compile-Spring-project-due-to-annotations-tp4309204p4309204.html > Sent from the Maven - Users mailing list archive at Nabble.com. -- "Legacy code" often differs from its suggested alternative by actually working and scaling. - Bjarne Stroustrup http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury |
|
In reply to this post by snowb0y
> org.apache.maven.plugins
> maven-eclipse-plugin > > 1.6 > 1.6 > Well, you should use the maven-compiler-plugin as described in http://maven.apache.org/plugins/maven-compiler-plugin/howto.html, not the maven-eclipse-plugin. Manuel --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by snowb0y
the solution is accomplished by following the instructions in the displayed error message export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk export PATH=$JAVA_HOME/bin:$PATH <configuration> <source>1.6</source> <target>1.6</target> </configuration> Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Sun, 17 Apr 2011 09:55:42 -0700 > From: [hidden email] > To: [hidden email] > Subject: Maven refusing to compile Spring project due to annotations > > I'm running Eclipse and Maven on a Mac. Here's my version of Maven > > > $ mvn -version > Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100) > Java version: 1.6.0_22 > Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home > Default locale: en_US, platform encoding: MacRoman > OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac" > > > What I'm trying to do is use Maven to compile my Spring project so I can > deploy the packaged war to a Tomcat. I setup my pom.xml (see below) and > asked mvn to create the package. The build failed with the following error: > > > Compilation failure > /path/to/WelcomeController.java:[7,1] annotations are not supported in > -source 1.3 > (use -source 5 or higher to enable annotations) > @Controller > > > Doing mvn compile gives the same error. Google showed me that the > 1.3-compiler-as-default was a known problem with Maven and I was happy to > find a fix explained here: > > http://maven.apache.org/plugins/maven-compiler-plugin/howto.html > http://maven.apache.org/plugins/maven-compiler-plugin/howto.html > > > But it's still not working ): In desperation I followed these instructions: > > > http://pwong-tipsandtricks.blogspot.com/2009/02/install-and-test-maven-on-centos-52.html > http://pwong-tipsandtricks.blogspot.com/2009/02/install-and-test-maven-on-centos-52.html > and put a fresh maven on my Linux box. The build failed with the same error, > so it seems that my pom.xml is the culprit. But how? Here's the pom. Any > ideas welcome! > > > > > 4.0.0 > net.fnarg.twotrack > twotrack-webapp > war > 1.0-SNAPSHOT > Twotrack Webapp > http://maven.apache.org > > > 3.0.5.RELEASE > twotrack > apache-tomcat-twotrack > twotrack > twotrack > > > > > com.springsource.repository.bundles.release > SpringSource Enterprise Bundle Repository - SpringSource Bundle > Releases > http://repository.springsource.com/maven/bundles/milestone > > > com.springsource.repository.bundles.external > SpringSource Enterprise Bundle Repository - External Bundle > Releases > http://repository.springsource.com/maven/bundles/external > > > > > > javax.servlet > jstl > 1.2 > > > javax.el > el-api > 1.0 > provided > > > org.apache.taglibs > com.springsource.org.apache.taglibs.standard > 1.1.2 > > > javax.servlet > servlet-api > 2.5 > provided > > > org.springframework > spring-context > ${spring.version} > > > org.springframework > spring-web > ${spring.version} > > > org.springframework > spring-webmvc > ${spring.version} > > > junit > junit > 3.8.1 > test > > > > > > > org.apache.maven.plugins > maven-eclipse-plugin > > 1.6 > 1.6 > > > > twotrack > > > src/main/resources > true > > > src/main/webapp > true > > > > > > > > > -- > View this message in context: http://maven.40175.n5.nabble.com/Maven-refusing-to-compile-Spring-project-due-to-annotations-tp4309204p4309204.html > Sent from the Maven - Users mailing list archive at Nabble.com. |
|
In reply to this post by Jeff MAURY
Hi Jeff,
Thanks for reply. It's the same error with these 3 variations.
<configuration>
<wtpversion>1.5</wtpversion>
</configuration>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
The pom used to have a parent from a repo at my place of work. My goal is to get the build working without the parent as this isn't a work project. But then the compile error kicked in .. |
| Powered by Nabble | See how NAML generates this page |
