NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

how to use source level 5 in Maven projects?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
legolas
Posted via mailing list.





PostPosted: Fri Dec 05, 2008 9:36 am    Post subject: how to use source level 5 in Maven projects? Reply with quote

Hi
Thank you for reading my post.
I am trying to use annotation in a Maven project and it constantly disallow
me with an error like:

Annotation is not allowed in -source 1.3 use -source 5 or higher to enable
annotation.

but there is no place to change the source level in project properties.

Can you please let me know how to do it?

--
View this message in context: http://www.nabble.com/how-to-use-source-level-5-in-Maven-projects--tp20850498p20850498.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Marco Huber
Posted via mailing list.





PostPosted: Fri Dec 05, 2008 9:44 am    Post subject: how to use source level 5 in Maven projects? Reply with quote

Hi legolas,

you must add the source level at your pom.xml (you find it under
"Project Files" like:

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

The pom.xml is the project configuration file, like it is common in
Maven, so Netbeans use this file instead creating an own config file/folder.

HTH,
Marco


legolas wrote:
Quote:
Hi
Thank you for reading my post.
I am trying to use annotation in a Maven project and it constantly disallow
me with an error like:

Annotation is not allowed in -source 1.3 use -source 5 or higher to enable
annotation.

but there is no place to change the source level in project properties.

Can you please let me know how to do it?
Back to top
mkleint
Posted via mailing list.





PostPosted: Fri Dec 05, 2008 10:00 am    Post subject: how to use source level 5 in Maven projects? Reply with quote

legolas wrote:
Quote:
Hi
Thank you for reading my post.
I am trying to use annotation in a Maven project and it constantly disallow
me with an error like:

Annotation is not allowed in -source 1.3 use -source 5 or higher to enable
annotation.

but there is no place to change the source level in project properties.

Can you please let me know how to do it?


Well, the Sources panel in the project Properties dialog has the Source
level combo box.
It will write the appropriate maven-compiler-plugin configuration to the
pom.xml

Milos
Back to top
legolas
Posted via mailing list.





PostPosted: Fri Dec 05, 2008 10:05 am    Post subject: how to use source level 5 in Maven projects? Reply with quote

Thank you marco.
here is my pom.xml, but I do not know where I should add your codes.



<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>sample.first</groupId>
<artifactId>first01</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>first01</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

can you please let me know where to add your code?

Thanks



Marco Huber wrote:
Quote:

Hi legolas,

you must add the source level at your pom.xml (you find it under
"Project Files" like:

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

The pom.xml is the project configuration file, like it is common in
Maven, so Netbeans use this file instead creating an own config
file/folder.

HTH,
Marco


legolas wrote:
Quote:
Hi
Thank you for reading my post.
I am trying to use annotation in a Maven project and it constantly
disallow
me with an error like:

Annotation is not allowed in -source 1.3 use -source 5 or higher to
enable
annotation.

but there is no place to change the source level in project properties.

Can you please let me know how to do it?





--
View this message in context: http://www.nabble.com/how-to-use-source-level-5-in-Maven-projects--tp20850498p20850893.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Marco Huber
Posted via mailing list.





PostPosted: Fri Dec 05, 2008 11:05 am    Post subject: how to use source level 5 in Maven projects? Reply with quote

Hi legolas,

the entry is on the project-tag-level:

<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>sample.first</groupId>
<artifactId>first01</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>first01</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- Add here -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

</project>

Or you can configure how Milos described it.

Regards,
Marco

P. S. If you are new in maven you should maybe read
http://maven.apache.org/guides/getting-started/index.html


legolas wrote:
Quote:
Thank you marco.
here is my pom.xml, but I do not know where I should add your codes.



<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>sample.first</groupId>
<artifactId>first01</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>first01</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

can you please let me know where to add your code?

Thanks



Marco Huber wrote:
Quote:
Hi legolas,

you must add the source level at your pom.xml (you find it under
"Project Files" like:

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

The pom.xml is the project configuration file, like it is common in
Maven, so Netbeans use this file instead creating an own config
file/folder.

HTH,
Marco


legolas wrote:
Quote:
Hi
Thank you for reading my post.
I am trying to use annotation in a Maven project and it constantly
disallow
me with an error like:

Annotation is not allowed in -source 1.3 use -source 5 or higher to
enable
annotation.

but there is no place to change the source level in project properties.

Can you please let me know how to do it?



Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo